Created
August 19, 2011 10:53
-
-
Save gregnewman/1156570 to your computer and use it in GitHub Desktop.
Example for Imagekit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Book(models.Model): | |
title = models.CharField(max_length=200) | |
class Page(ImageModel): | |
book = models.ForeignKey(Book) | |
image = models.ImageField(upload_to='book_photos') | |
num_views = models.PositiveIntegerField(editable=False, default=0) | |
class IKOptions: | |
# This inner class to define the ImageKit options for the model | |
spec_module = 'books.image_specs' | |
cache_dir = 'book_photos' | |
image_field = 'image' | |
save_count_as = 'num_views' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment