I was searching old answers on how to show the dynamic Openlayers map but not allow you to move/change the coordinates/geometry of a given GeoDjango field (a PointField in my case) in the Django Admin.
Old solutions mention using the OSMGeoAdmin class (from django.contrib.gis.admin), which allows you to set the modifiable attribute to False to make the map be shown but not modifiable. This is exactly what I want.
However, that class is deprecated since Django 4.0, and you are now prompted to use ModelAdmin or GISModelAdmin instead, but none of the two allow me to replicate the same behaviour as OSMGeoAdmin.
I checked the documentation for GISModelAdmin and I found out that I can send some parameters to the gis_widget using the dictionary gis_widget_kwargs, but the modifiable attribute is still not working, so I am beggining to think that the functionality was removed.
Example of code to pass parameters to the gis_widget:
@admin.register(m.City)
class CityAdmin(GISModelAdmin):
gis_widget_kwargs = {'attrs':{'map_width':1200, 'modifiable':False}}
Am I missing something? Is that really no longer possible with GISModelAdmin?
Do I have to go through the annoying process of creating my own widget to replicate this behaviour?
If someone has faced the same situation, did you manage to find a workaround?