Question

I have a model with a PointField from django.contrib.gis.db.models . This somehow doesn't let the admin site show the objects with a nice table of fields and values. Instead it displays one field named after the model name. The values are just a bunch of ' object'. With the name of the model. If I click the object I can edit it fine. It would be nice however to be able to filter and see the field values at the admin/ page itself.

Was it helpful?

Solution

Since PointField does not have a __unicode__ attribute, for the proper name to show up, you can register a new admin model object.

Now, in the admin's list_display,

class PointFieldAdmin(admin.ModelAdmin):
    list_display = ('name', 'field_x', 'field_y', ...)

admin.register(PointField, PointFieldAdmin)

More on admin models registering here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top