summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/birds/admin.py11
-rw-r--r--app/birds/models.py4
2 files changed, 9 insertions, 6 deletions
diff --git a/app/birds/admin.py b/app/birds/admin.py
index ef394d9..e70f9db 100644
--- a/app/birds/admin.py
+++ b/app/birds/admin.py
@@ -4,6 +4,7 @@ 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):
@@ -12,10 +13,10 @@ def convertll(lat, lon):
return pnt.y, pnt.x
-# Florida: lat, lon = convertll(29.658057, -84.867797)
-# Athens:
-lon = -9285175
-lat = 4025046
+def get_latlon():
+ loc = CheckIn.objects.latest()
+ lat_converted, lon_converted = convertll(loc.lat, loc.lon)
+ return lat_converted, lon_converted
class BirdClassAdmin(admin.ModelAdmin):
@@ -54,6 +55,8 @@ class BirdSightingAdmin(OSMGeoAdmin):
),
)
# options for OSM map Using custom ESRI topo map
+ lat, lon = get_latlon()
+ print(lat, lon)
default_lon = lon
default_lat = lat
default_zoom = 13
diff --git a/app/birds/models.py b/app/birds/models.py
index afb6099..fc2ce30 100644
--- a/app/birds/models.py
+++ b/app/birds/models.py
@@ -93,8 +93,8 @@ class BirdSighting(models.Model):
location = models.ForeignKey(Location, blank=True)
date = models.DateTimeField('Date', default=timezone.now)
seen_by = models.ManyToManyField(User)
- images = models.ManyToManyField(LuxImage)
- audio = models.ManyToManyField(BirdAudio)
+ images = models.ManyToManyField(LuxImage, blank=True)
+ audio = models.ManyToManyField(BirdAudio, blank=True)
class Meta:
verbose_name_plural = 'Bird Sighting'