From ef2fbc67a923e4d39f0497943c11dc1eaeb74f5d Mon Sep 17 00:00:00 2001 From: luxagraf Date: Wed, 6 Sep 2017 19:28:47 -0600 Subject: updated bird and jrnl admins to make maps and photos better --- app/utils/util.py | 15 +++++++++++++++ app/utils/widgets.py | 1 + 2 files changed, 16 insertions(+) create mode 100644 app/utils/util.py (limited to 'app/utils') diff --git a/app/utils/util.py b/app/utils/util.py new file mode 100644 index 0000000..3da6d06 --- /dev/null +++ b/app/utils/util.py @@ -0,0 +1,15 @@ +from daily.models import CheckIn +from django.contrib.gis.geos import GEOSGeometry + + +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 + diff --git a/app/utils/widgets.py b/app/utils/widgets.py index 8e390d5..240820a 100644 --- a/app/utils/widgets.py +++ b/app/utils/widgets.py @@ -5,6 +5,7 @@ from django.contrib.admin.widgets import AdminFileWidget from django.contrib.gis.admin import OSMGeoAdmin from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ +from django.forms.widgets import SelectMultiple from django.conf import settings import markdown -- cgit v1.2.3