diff options
author | luxagraf <sng@luxagraf.net> | 2018-06-08 20:25:27 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2018-06-08 20:25:27 -0500 |
commit | 3ff0e1c9851744d05064c2787a8033c83123a414 (patch) | |
tree | f703e336dcb918d00f2b25e3ce63543bdce71d63 /app/sightings | |
parent | 42386165ed1d15361957d4a4756de6af0f38b64c (diff) |
testing inline maps
Diffstat (limited to 'app/sightings')
-rw-r--r-- | app/sightings/admin.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/app/sightings/admin.py b/app/sightings/admin.py index d6ac5d4..f07afc3 100644 --- a/app/sightings/admin.py +++ b/app/sightings/admin.py @@ -6,7 +6,7 @@ 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 class GalleryFormPlus(GalleryForm): def __init__(self, *args, **kwargs): @@ -24,8 +24,22 @@ class APClassAdmin(admin.ModelAdmin): list_filter = ('kind',) -class SightingInline(admin.TabularInline): +class SightingInline(OSMGeoAdmin, 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 @admin.register(AP) |