summaryrefslogtreecommitdiff
path: root/app/sightings/admin.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2024-05-09 16:09:09 -0500
committerluxagraf <sng@luxagraf.net>2024-05-09 16:09:09 -0500
commit36cec3379c541c93740dc50b4f706912edb5b69c (patch)
treedc8e083b230d840e5e5a4963d9af4375cc3986f5 /app/sightings/admin.py
parente6b98c3cbbe34430a93623ee45771a9448029cbf (diff)
sight: added map back
Diffstat (limited to 'app/sightings/admin.py')
-rw-r--r--app/sightings/admin.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/app/sightings/admin.py b/app/sightings/admin.py
index 7cc0319..e5e5aaf 100644
--- a/app/sightings/admin.py
+++ b/app/sightings/admin.py
@@ -1,11 +1,13 @@
import copy
from django.contrib import admin
+from django.contrib.gis.admin import GISModelAdmin
from .models import APClass, AP, Sighting, FieldNote
from utils.util import get_latlon
from utils.widgets import CustomSelectMultiple, LGEntryForm
from django.contrib.admin.options import FORMFIELD_FOR_DBFIELD_DEFAULTS
+
@admin.register(APClass)
class APClassAdmin(admin.ModelAdmin):
list_display = ('common_name', 'scientific_name', 'kind')
@@ -97,22 +99,24 @@ class APAdmin(admin.ModelAdmin):
@admin.register(Sighting)
-class SightingAdmin(admin.ModelAdmin):
+class SightingAdmin(GISModelAdmin):
list_filter = (('location', admin.RelatedOnlyFieldListFilter), 'pub_date')
list_display = ('ap', 'location', 'pub_date')
search_fields = ['ap__common_name',]
autocomplete_fields = ["ap"]
# options for OSM map Using custom ESRI topo map
lat, lon = get_latlon()
- default_lon = lon
- default_lat = lat
- default_zoom = 13
- 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,
+ "map_template": 'gis/admin/osm.html',
+ "openlayers_url": '/static/admin/js/OpenLayers.js'
+ }
+ }
fieldsets = (
('', {