summaryrefslogtreecommitdiff
path: root/app/utils
diff options
context:
space:
mode:
Diffstat (limited to 'app/utils')
-rw-r--r--app/utils/util.py6
-rw-r--r--app/utils/views.py6
-rw-r--r--app/utils/widgets.py17
3 files changed, 12 insertions, 17 deletions
diff --git a/app/utils/util.py b/app/utils/util.py
index d9b2318..32a9838 100644
--- a/app/utils/util.py
+++ b/app/utils/util.py
@@ -36,8 +36,10 @@ def convertll(lat, lon):
def get_latlon():
loc = apps.get_model('locations', 'LuxCheckIn').objects.latest()
- lat_converted, lon_converted = convertll(loc.lat, loc.lon)
- return lat_converted, lon_converted
+ # as of django 5, this isn't necessary anymore:
+ #lat_converted, lon_converted = convertll(loc.lat, loc.lon)
+ lat, lon = loc.point.y, loc.point.x
+ return lat, lon
def extract_main_image(markdown):
diff --git a/app/utils/views.py b/app/utils/views.py
index b678a33..76f1574 100644
--- a/app/utils/views.py
+++ b/app/utils/views.py
@@ -14,9 +14,9 @@ from media.models import LuxImage, LuxVideo, LuxAudio
BREADCRUMBS = {
'AP':'dialogue',
'Book':'Book Notes',
- 'Entry':'Jrnl',
'NewsletterMailing':'lttr',
'LuxImage':'lttr',
+ 'Sighting':'dialogue'
}
class PaginatedListView(ListView):
@@ -53,16 +53,16 @@ class LuxDetailView(DetailView):
'''
# Call the base implementation first to get a context
context = super(LuxDetailView, self).get_context_data(**kwargs)
- print(self.object._meta.verbose_name_plural)
try:
context['breadcrumbs'] = (BREADCRUMBS[self.object._meta.label.split(".")[1]],)
except KeyError:
if self.object._meta.verbose_name_plural == 'posts':
if self.object.get_post_type_display() != 'src':
context['breadcrumbs'] = (self.object.get_post_type_display()+"s",)
+ context['crumb_url'] = "/%ss/" % slugify(self.object.get_post_type_display())
else:
context['breadcrumbs'] = (self.object.get_post_type_display(),)
- context['crumb_url'] = "/%ss/" % slugify(self.object.get_post_type_display())
+ context['crumb_url'] = "/%s/" % slugify(self.object.get_post_type_display())
else:
context['breadcrumbs'] = (self.object._meta.verbose_name_plural,)
try:
diff --git a/app/utils/widgets.py b/app/utils/widgets.py
index 87b39ec..ffad8b1 100644
--- a/app/utils/widgets.py
+++ b/app/utils/widgets.py
@@ -1,8 +1,9 @@
import os
from django import forms
from django.contrib import admin
+
+from django.contrib.gis.admin import GISModelAdmin
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 gettext_lazy as _
from django.template.loader import render_to_string
@@ -14,6 +15,7 @@ import markdown
from bs4 import BeautifulSoup
from django.utils.module_loading import import_string
+from utils.util import get_latlon
class CustomSelectMultiple(SelectMultiple):
@@ -130,15 +132,6 @@ class LGEntryFormSmall(forms.ModelForm):
}
-class OLAdminBase(OSMGeoAdmin):
- default_lon = -9285175
- default_lat = 4025046
- default_zoom = 15
- units = True
- scrollable = False
- map_width = 700
- map_height = 425
- map_template = 'gis/admin/osm.html'
- openlayers_url = '/static/admin/js/OpenLayers.js'
-
+class OLAdminBase(GISModelAdmin):
+ pass