diff options
Diffstat (limited to 'app/birds/admin.py')
-rw-r--r-- | app/birds/admin.py | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/app/birds/admin.py b/app/birds/admin.py index aa2aabb..b5c6a7e 100644 --- a/app/birds/admin.py +++ b/app/birds/admin.py @@ -1,22 +1,9 @@ from django.contrib import admin 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 -from daily.models import CheckIn - - -def convertll(lat, lon): - pnt = GEOSGeometry('POINT({0} {1})'.format(lon, lat), srid=4326) - pnt.transform(3857) - return pnt.y, pnt.x - - -def get_latlon(): - loc = CheckIn.objects.latest() - lat_converted, lon_converted = convertll(loc.lat, loc.lon) - return lat_converted, lon_converted +from utils.util import get_latlon class BirdClassAdmin(admin.ModelAdmin): @@ -31,9 +18,14 @@ class BirdAdmin(admin.ModelAdmin): list_display = ('pk', 'common_name', 'scientific_name', 'code', 'bird_class') list_filter = ('bird_class',) +class GalleryFormPlus(GalleryForm): + def __init__(self, *args, **kwargs): + super(GalleryFormPlus, self).__init__(*args, **kwargs) + self.base_fields['seen_by'].widget = CustomSelectMultiple() + class BirdSightingAdmin(OSMGeoAdmin): - form = GalleryForm + form = GalleryFormPlus list_filter = ( ) list_display = ('bird', 'location') |