Opened 17 years ago
Closed 17 years ago
#6747 closed (invalid)
geometry field does not work in Admin list_display
Reported by: | Owned by: | jbronn | |
---|---|---|---|
Component: | GIS | Version: | gis |
Severity: | Keywords: | gis geometry admin list_display | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
A geometry field (PointField, PolygonField) does not render in the Admin applications list_display. It does however in the 'Changes' screen of the Admin app.
It seems the sql for the list_display does not include 'AS_TEXT(GeomField)' as it does on the 'Changes' screen
The error returned boils down to:
String or unicode input unrecognized as WKT EWKT, and HEXEWKB.
Change History (3)
comment:1 by , 17 years ago
Keywords: | gis geometry admin list_display added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 17 years ago
comment:3 by , 17 years ago
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
I agree this is not the best behavior -- it is a result of overriding the default manager for the model (see #6358). A workaround is to use the little-known manager
option on the inner Admin
class. Here's an example:
from django.contrib.gis.db import models class City(models.Model): name = models.CharField(max_length=30) point = models.PointField() objects = models.GeoManager() class Meta: verbose_name_plural = 'Cities' class Admin: list_display = ('name', 'point') manager = models.GeoManager() def __unicode__(self): return self.name
I've confirmed this is a bug. For now, the workaround is not to use
GeometryField
s in the adminlist_display
option.