From 06085dc492c1d558c0956cad7f3b4b6e39f11187 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Thu, 9 May 2024 16:46:51 -0500 Subject: admin: fixed all the maps to work with django 5 changes --- app/posts/admin.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'app/posts') diff --git a/app/posts/admin.py b/app/posts/admin.py index 5c27f64..96883f6 100644 --- a/app/posts/admin.py +++ b/app/posts/admin.py @@ -1,4 +1,5 @@ from django.contrib import admin +from django.contrib.gis.admin import GISModelAdmin from django import forms from django.contrib.contenttypes.admin import GenericStackedInline @@ -10,7 +11,7 @@ from utils.util import get_latlon @admin.register(Post) -class PostAdmin(admin.ModelAdmin): +class PostAdmin(GISModelAdmin): form = LGEntryForm def get_queryset(self, request): @@ -76,15 +77,15 @@ class PostAdmin(admin.ModelAdmin): ) # options for OSM map Using custom ESRI topo map lat, lon = get_latlon() - default_lon = lon - default_lat = lat - default_zoom = 10 - units = True - scrollable = False - map_width = 700 - map_height = 425 - map_template = 'gis/admin/osm.html' - openlayers_url = '/static/admin/js/OpenLayers.js' + gis_widget_kwargs = { + "attrs": { + "default_lon": lon, + "default_lat": lat, + "default_zoom": 6, + "map_width": 700, + "map_height": 425, + } + } class Media: js = ('image-loader.js', 'next-prev-links.js') -- cgit v1.2.3