theatlantic / django-nested-admin

Django admin classes that allow for nested inlines
http://django-nested-admin.readthedocs.org/
Other
690 stars 97 forks source link

Compatibility with Geodjango OSMGeoAdmin / GISModelAdmin #215

Closed mapperfr closed 2 years ago

mapperfr commented 2 years ago

On admin.py, my main model admin class is an OSMGeoAdmin from Geodjango (recently upgraded to a GISModelAdmin with Django 4). It allows me to display an OpenStreetMap map window on a point field from the model. If I switch to NestedModelAdmin, as needed to display the nested models in my main model admin, the Leaflet map window is still here but I lose the OSM map tiles. It's lilke django-nested-admin and Geodjango are not compatibles.

fdintino commented 2 years ago

Try using GeoModelAdminMixin with NestedModelAdmin, something like:

from django.contrib.gis.admin.options import GeoModelAdminMixin

class MyModelAdmin(GeoModelAdminMixin, nested_admin.NestedModelAdmin):
   # ...
mapperfr commented 2 years ago

Thanks @fdintino, it works as expected now. Now I need to learn about those Mixins :)