Geodjango - read_only fields visible on map in admin panel

Hello,

I am looking for answer how to show map of a given GeoDjango field in the Django Admin in the read-only mode. Everything works nice, when my field is in the read-write mode (I can see interactive map), but when I add selected field to readonly_fields instead of a map I get EWKT notation

Read-write

class TestAdmin(admin.GISModelAdmin):
    readonly_fields = []

Read-only

class TestAdmin(admin.GISModelAdmin):
    readonly_fields = ["point"]

image

Linked topic on stack-overflow (without any answers yet) Readonly map for GeoDjango fields in Django>=4.0? - Stack Overflow

1 Like

I don’t think Django supports that currently. I guess it could be some option in GeoModelAdminMixin because displaying the EWKT as currently or displaying a read-only map are two valid use cases for read-only display of geometries, in my opinion.

2 Likes

I see, that visualization of some special read-only fields are handled here.

Maybe this approach would be easier than rewriting GeoModelAdminMixin

because displaying the EWKT as currently or displaying a read-only map are two valid use cases

In this case we could just display read-only map and EWKT below