summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-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)