diff options
Diffstat (limited to 'app/media/admin.py')
-rw-r--r-- | app/media/admin.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/app/media/admin.py b/app/media/admin.py index 9278c56..305ebd7 100644 --- a/app/media/admin.py +++ b/app/media/admin.py @@ -38,13 +38,30 @@ class LuxImageAdmin(OSMGeoAdmin): fieldsets = ( (None, { - 'fields': ('title', ('image'), 'pub_date', 'sizes', 'alt', 'caption', 'point', ('is_public'), ('photo_credit_source', 'photo_credit_url')) + 'fields': ( + 'image', + 'alt', + 'sizes', + 'caption', + 'pub_date', + 'title', + ) }), - ('Exif Data', { + ('Exif and Other Data', { 'classes': ('collapse',), - 'fields': ('exif_raw', 'exif_aperture', 'exif_make', 'exif_model', 'exif_exposure', 'exif_iso', 'exif_focal_length', 'exif_lens', 'exif_date', 'height', 'width'), + 'fields': ( + 'point', + ('is_public'), + ('photo_credit_source', 'photo_credit_url'), + 'exif_raw', 'exif_aperture', 'exif_make', 'exif_model', 'exif_exposure', 'exif_iso', 'exif_focal_length', 'exif_lens', 'exif_date', 'height', 'width'), }), ) + def save_related(self, request, form, formsets, change): + super(LuxImageAdmin, self).save_related(request, form, formsets, change) + if not form.instance.sizes.all(): + print("there are no sizes") + form.instance.sizes.add(*LuxImageSize.objects.filter(slug__in=["picwide-sm", "picwide-med", "picwide"])) + class Media: js = ('image-preview.js', 'next-prev-links.js') |