O'Reilly logo

Python Geospatial Development - Third Edition by Erik Westra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Playing with the admin system

The built-in admin application is enabled by default in new Django projects. Before we can use it, however, we need to register the various database models we want it to support. To do this, edit the admin.py module within the shapeEditor/shared directory, and enter the following into this file:

from django.contrib.gis import admin
from shapeEditor.shared.models import *

admin.site.register(Shapefile, admin.ModelAdmin)
admin.site.register(Feature, admin.GeoModelAdmin)
admin.site.register(Attribute, admin.ModelAdmin)
admin.site.register(AttributeValue, admin.ModelAdmin)

The ModelAdmin class tells Django how to display the model within the admin interface. Notice that we use the GeoModelAdmin class for the Feature class. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required