I have a model that looks like this:
class ProjectImage(models.Model):
big_thumb = ThumbnailField(upload_to='profiles', size=(500, 500))
med_thumb = ThumbnailField(upload_to='profiles', size=(300, 300))
small_thumb = ThumbnailField(upload_to='profiles', size=(100, 100))
I associate ProjectImage with a Project as a TabularInline. In the admin, I’d like to be able to say if the medium and/or small thumbnails were not provided, use the same image as the big thumbnail. However, I’m having a hard time figuring out how to specify this behavior.
You have two options in this case, you can either over-ride
ProjectImage‘s save defintion and have it copybig_thumbtomed_thumbandsmall_thumbif they are None, or just create a simple model definition to display each field.And do the same for
small_thumbThat keeps you from fidgeting with the save method and having to copy things over and waste space.I can’t remember if
ImageFieldhas aget_FOO_urltype definition but if it does you could always over-ride that.