diff options
Diffstat (limited to 'app')
-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) |