diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/birds/admin.py | 3 | ||||
-rw-r--r-- | app/photos/admin.py | 6 | ||||
-rw-r--r-- | app/photos/forms.py | 5 | ||||
-rw-r--r-- | app/photos/models.py | 1 |
4 files changed, 8 insertions, 7 deletions
diff --git a/app/birds/admin.py b/app/birds/admin.py index 472c075..ef394d9 100644 --- a/app/birds/admin.py +++ b/app/birds/admin.py @@ -3,6 +3,8 @@ from django.contrib.gis.admin import OSMGeoAdmin from birds.models import BirdSighting, BirdAudio, BirdClass, Bird from django.contrib.gis.geos import GEOSGeometry +from photos.forms import GalleryForm + def convertll(lat, lon): pnt = GEOSGeometry('POINT({0} {1})'.format(lon, lat), srid=4326) @@ -30,6 +32,7 @@ class BirdAdmin(admin.ModelAdmin): class BirdSightingAdmin(OSMGeoAdmin): + form = GalleryForm list_display = ('bird', 'location') list_filter = ('seen_by', 'location',) fieldsets = ( diff --git a/app/photos/admin.py b/app/photos/admin.py index 9453734..83fbae8 100644 --- a/app/photos/admin.py +++ b/app/photos/admin.py @@ -38,7 +38,7 @@ class LuxImageAdmin(OSMGeoAdmin): fieldsets = ( (None, { - 'fields': (('image', 'pub_date'), 'sizes', ('title', 'alt'), 'caption', 'point', ('is_public', 'is_video'), ('photo_credit_source','photo_credit_url')) + 'fields': (('image', 'pub_date'), 'sizes', ('title', 'alt'), 'caption', 'point', ('is_public', 'is_video'), ('photo_credit_source', 'photo_credit_url')) }), ('Exif Data', { 'classes': ('collapse',), @@ -47,10 +47,6 @@ class LuxImageAdmin(OSMGeoAdmin): ) - - - - admin.site.register(LuxImage, LuxImageAdmin) diff --git a/app/photos/forms.py b/app/photos/forms.py index 8ad89f2..03c6f09 100644 --- a/app/photos/forms.py +++ b/app/photos/forms.py @@ -39,8 +39,11 @@ class GalleryForm(forms.ModelForm): items = [] for image in images: items.append( - (image.pk, mark_safe('%sqq%s' % (image.title, image.get_image_name()))) + (image.pk, mark_safe('%sqq%sqq%s' % (image.title, image.get_image_by_size('tn'), image.pk))) ) + + + self.fields['images'].choices = items self.fields['images'].allow_tags = True diff --git a/app/photos/models.py b/app/photos/models.py index 048dd65..6907a25 100644 --- a/app/photos/models.py +++ b/app/photos/models.py @@ -74,7 +74,6 @@ class LuxImage(models.Model): if size.width <= 800: return self.get_image_by_size(size) - def get_image_name(self): return self.image.url.split("original/")[1][5:-4] |