summaryrefslogtreecommitdiff
path: root/app/sightings/admin.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2018-06-08 20:35:16 -0500
committerluxagraf <sng@luxagraf.net>2018-06-08 20:35:16 -0500
commita32a107db3fe5b5c0742b2ba3f6a767f427fec5e (patch)
tree620160090d1c5e971866dfbdde4b21fdd00838ec /app/sightings/admin.py
parent3ff0e1c9851744d05064c2787a8033c83123a414 (diff)
experimenting with admin map widget 3rd party
Diffstat (limited to 'app/sightings/admin.py')
-rw-r--r--app/sightings/admin.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/app/sightings/admin.py b/app/sightings/admin.py
index f07afc3..ce1c66a 100644
--- a/app/sightings/admin.py
+++ b/app/sightings/admin.py
@@ -1,12 +1,13 @@
from django.contrib import admin
from django.contrib.gis.admin import OSMGeoAdmin
+from django.contrib.gis.db.models import PointField
from .models import APClass, AP, Sighting
from photos.forms import GalleryForm
from utils.util import get_latlon
from utils.widgets import CustomSelectMultiple, LGEntryForm
from .forms import SightingsForm
-from django.contrib.admin.options import FORMFIELD_FOR_DBFIELD_DEFAULTS
+from mapwidgets.widgets import GooglePointFieldInlineWidget
class GalleryFormPlus(GalleryForm):
def __init__(self, *args, **kwargs):
@@ -24,22 +25,12 @@ class APClassAdmin(admin.ModelAdmin):
list_filter = ('kind',)
-class SightingInline(OSMGeoAdmin, admin.StackedInline):
+class SightingInline(admin.StackedInline):
model = Sighting
extra = 1
-
- def __init__(self, parent_model, admin_site):
- self.admin_site = admin_site
- self.parent_model = parent_model
- self.opts = self.model._meta
- self.has_registered_model = admin_site.is_registered(self.model)
- overrides = FORMFIELD_FOR_DBFIELD_DEFAULTS.copy()
- overrides.update(self.formfield_overrides)
- self.formfield_overrides = overrides
- if self.verbose_name is None:
- self.verbose_name = self.model._meta.verbose_name
- if self.verbose_name_plural is None:
- self.verbose_name_plural = self.model._meta.verbose_name_plural
+ formfield_overrides = {
+ PointField: {"widget": GooglePointFieldInlineWidget}
+ }
@admin.register(AP)