[Django] #27674: Deprecate GeoModelAdmin and OSMGeoAdmin

107 views
Skip to first unread message

Django

unread,
Jan 2, 2017, 11:56:17 AM1/2/17
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
------------------------------------------------+------------------------
Reporter: Claude Paroz | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
The geometry fields now have default map widgets, so the need of gis-
specific `ModelAdmin` classes is therefore less relevant.

However, the fact that `ModelAdmin.formfield_for_dbfield` is not
documented does not help, so I'd suggest to document it first.

--
Ticket URL: <https://code.djangoproject.com/ticket/27674>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 2, 2017, 1:00:50 PM1/2/17
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
--------------------------------------+------------------------------------

Reporter: Claude Paroz | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted


Comment:

Could you describe the relevance of `formfield_for_dbfield` in a bit more
detail?

--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:1>

Django

unread,
Jan 2, 2017, 2:04:23 PM1/2/17
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
--------------------------------------+------------------------------------

Reporter: Claude Paroz | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Claude Paroz):

Sure. The typical example is to be sure all geometry widgets use a
specific map widget, or specific map widget attributes.
With `formfield_overrides`, you'd have to specify all field types:
{{{
class MyModelAdmin(admin.ModelAdmin):
formfield_overrides = {
models.PointField: {'widget': MyCustomMapWidget},
models.PolygonField: {'widget': MyCustomMapWidget},
models.LineField: {'widget': MyCustomMapWidget},
models.MultiPointField: {'widget': MyCustomMapWidget},
...
}
}}}
which is not nice if you have many geometry field types in your project. I
think it's a case where `formfield_for_dbfield` is handy:
{{{
class MyModelAdmin(admin.ModelAdmin):
def formfield_for_dbfield(self, db_field, request, **kwargs):
if isinstance(db_field, models.GeometryField) and db_field.dim <
3:
kwargs['widget'] = OSMWidget(default_lon=151, default_lat=-33)
return db_field.formfield(**kwargs)
else:
return super(GeoModelAdmin,
self).formfield_for_dbfield(db_field, request, **kwargs)
}}}

An alternative would be to still provide a GIS admin utility (subclass or
mixin) which sets the same map widget for all geometry fields, like the
current `GeoModelAdmin.get_map_widget()`. Basically the current code
without all the boiler plate code copying class attributes to widget
attributes.

--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:2>

Django

unread,
Jan 2, 2017, 5:58:35 PM1/2/17
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
--------------------------------------+------------------------------------

Reporter: Claude Paroz | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham):

Another idea: I like to see this sort of issue solved at the form level,
if possible, to allow reusing the solution outside the admin.

--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:3>

Django

unread,
Nov 25, 2020, 6:26:07 PM11/25/20
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Giannis
Type: | Adamopoulos
Cleanup/optimization | Status: assigned
Component: GIS | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Giannis Adamopoulos):

* owner: nobody => Giannis Adamopoulos
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:4>

Django

unread,
Nov 29, 2020, 6:21:32 PM11/29/20
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Giannis
Type: | Adamopoulos
Cleanup/optimization | Status: assigned
Component: GIS | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Giannis Adamopoulos):

[https://github.com/django/django/pull/13733 Submitted PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:5>

Django

unread,
Nov 30, 2020, 12:25:01 AM11/30/20
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Giannis
Type: | Adamopoulos
Cleanup/optimization | Status: assigned
Component: GIS | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:6>

Django

unread,
Nov 30, 2020, 1:05:34 AM11/30/20
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Giannis
Type: | Adamopoulos
Cleanup/optimization | Status: assigned
Component: GIS | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
* needs_docs: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:7>

Django

unread,
Sep 15, 2021, 7:19:48 AM9/15/21
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Giannis
Type: | Adamopoulos
Cleanup/optimization | Status: assigned
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
* needs_docs: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:8>

Django

unread,
Sep 17, 2021, 3:18:44 AM9/17/21
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Giannis
Type: | Adamopoulos
Cleanup/optimization | Status: closed
Component: GIS | Version: dev
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"4555aa0a489cb9dcf764edf12339097cdfa5ff84" 4555aa0a]:
{{{
#!CommitTicketReference repository=""
revision="4555aa0a489cb9dcf764edf12339097cdfa5ff84"
Fixed #27674 -- Deprecated GeoModelAdmin and OSMGeoAdmin.

Co-authored-by: Mariusz Felisiak <felisiak...@gmail.com>
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:9>

Django

unread,
Dec 16, 2021, 3:48:36 PM12/16/21
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Giannis
Type: | Adamopoulos
Cleanup/optimization | Status: closed
Component: GIS | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Nick Pope):

While looking into #33372 I noticed that there are two `OpenLayersWidget`
classes:

- `django.contrib.gis.admin.widgets.OpenLayersWidget` - this is used by
the deprecated `GeoModelAdmin` class and targets OpenLayers 2.x
- `django.contrib.gis.forms.widgets.OpenLayersWidget` - this is used as a
parent to `OSMWidget` (used by the new `GISModelAdmin`) and targets
OpenLayers 3.x

Deprecation warnings were added for `GeoModelAdmin` and `OSMGeoAdmin` as
part of this ticket but `.admin.widgets.OpenLayersWidget` has no warning.
Do we need to add one?

Do we also need to warn about `gis/admin/openlayers.html` and
`gis/admin/osm.html` templates going away? (Not sure whether we add a
documentation note?)

--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:10>

Django

unread,
Dec 17, 2021, 12:15:55 AM12/17/21
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Giannis
Type: | Adamopoulos
Cleanup/optimization | Status: new

Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: closed => new
* resolution: fixed =>
* needs_tests: 1 => 0
* stage: Ready for checkin => Accepted


Comment:

Replying to [comment:10 Nick Pope]:


> While looking into #33372 I noticed that there are two
`OpenLayersWidget` classes:
>
> - `django.contrib.gis.admin.widgets.OpenLayersWidget` - this is used by
the deprecated `GeoModelAdmin` class and targets OpenLayers 2.x
> - `django.contrib.gis.forms.widgets.OpenLayersWidget` - this is used as
a parent to `OSMWidget` (used by the new `GISModelAdmin`) and targets
OpenLayers 3.x
>
> Deprecation warnings were added for `GeoModelAdmin` and `OSMGeoAdmin` as
part of this ticket but `.admin.widgets.OpenLayersWidget` has no warning.
Do we need to add one?

Agreed, we can deprecate
`django.contrib.gis.admin.widgets.OpenLayersWidget` in Django 4.1 and
remove it in 5.0. Let's reopen.

> Do we also need to warn about `gis/admin/openlayers.html` and
`gis/admin/osm.html` templates going away? (Not sure whether we add a
documentation note?)

As far as I'm concerned, it is not needed.

--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:11>

Django

unread,
Dec 17, 2021, 1:21:25 AM12/17/21
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Giannis
Type: | Adamopoulos
Cleanup/optimization | Status: new

Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* has_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:12>

Django

unread,
Dec 20, 2021, 3:54:46 AM12/20/21
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Giannis
Type: | Adamopoulos
Cleanup/optimization | Status: new

Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"448145092c23074b5c3b6c0502358c1d7eface8b" 44814509]:
{{{
#!CommitTicketReference repository=""
revision="448145092c23074b5c3b6c0502358c1d7eface8b"
Refs #27674 -- Added tests for GISModelAdmin.gis_widget_kwargs.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:13>

Django

unread,
Dec 31, 2021, 4:51:43 AM12/31/21
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
--------------------------------------+------------------------------------
Reporter: Claude Paroz | Owner: (none)
Type: Cleanup/optimization | Status: assigned

Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* owner: Giannis Adamopoulos => (none)


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:14>

Django

unread,
Dec 31, 2021, 4:51:48 AM12/31/21
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
--------------------------------------+------------------------------------
Reporter: Claude Paroz | Owner: (none)
Type: Cleanup/optimization | Status: new

Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:15>

Django

unread,
Apr 22, 2022, 12:28:09 AM4/22/22
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Mariusz
Type: | Felisiak
Cleanup/optimization | Status: assigned

Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: (none) => Mariusz Felisiak


* status: new => assigned

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/15624 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:16>

Django

unread,
Apr 22, 2022, 5:37:30 AM4/22/22
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Mariusz
Type: | Felisiak
Cleanup/optimization | Status: assigned
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by GitHub <noreply@…>):

In [changeset:"eeb0bb63795f7500156abaed2a94aae681a9fc4a" eeb0bb6]:
{{{
#!CommitTicketReference repository=""
revision="eeb0bb63795f7500156abaed2a94aae681a9fc4a"
Refs #27674 --- Deprecated django.contrib.gis.admin.OpenLayersWidget.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:17>

Django

unread,
Apr 22, 2022, 5:37:54 AM4/22/22
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Mariusz
Type: | Felisiak
Cleanup/optimization | Status: closed
Component: GIS | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: assigned => closed
* resolution: => fixed


--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:18>

Django

unread,
Jan 17, 2023, 5:49:44 AM1/17/23
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Mariusz
Type: | Felisiak
Cleanup/optimization | Status: closed
Component: GIS | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"ce7b4f39e3635bfcaa2cec84d5da93c1dedcaa9c" ce7b4f3]:
{{{
#!CommitTicketReference repository=""
revision="ce7b4f39e3635bfcaa2cec84d5da93c1dedcaa9c"
Refs #27674 -- Removed django.contrib.gis.admin.OpenLayersWidget per
deprecation timeline.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:20>

Django

unread,
Jan 17, 2023, 5:49:46 AM1/17/23
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Mariusz
Type: | Felisiak
Cleanup/optimization | Status: closed
Component: GIS | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"4982958ec0c359908566fc1f34ef71297ea4337d" 4982958]:
{{{
#!CommitTicketReference repository=""
revision="4982958ec0c359908566fc1f34ef71297ea4337d"
Refs #27674 -- Removed GeoModelAdmin and OSMGeoAdmin per deprecation
timeline.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:19>

Django

unread,
Jan 23, 2025, 3:33:23 AMJan 23
to django-...@googlegroups.com
#27674: Deprecate GeoModelAdmin and OSMGeoAdmin
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Mariusz
Type: | Felisiak
Cleanup/optimization | Status: closed
Component: GIS | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by GitHub <noreply@…>):

In [changeset:"23c960a98e0d054d51dadda7049a54a083ef1155" 23c960a9]:
{{{#!CommitTicketReference repository=""
revision="23c960a98e0d054d51dadda7049a54a083ef1155"
Refs #27674 -- Removed unused GIS icons.

Unused since 4982958ec0c359908566fc1f34ef71297ea4337d.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27674#comment:21>
Reply all
Reply to author
Forward
0 new messages