GeoDjango Management Commands¶
- django-admin.py inspectdb
When django.contrib.gis is in your INSTALLED_APPS, the inspectdb management command is overridden with one from GeoDjango. The overridden command is spatially-aware, and places geometry fields in the auto-generated model definition, where appropriate.
ogrinspect <data_source> <model_name>¶
- django-admin.py ogrinspect¶
The ogrinpsect management command will inspect the given OGR-compatible DataSource (e.g., a shapefile) and will output a GeoDjango model with the given model name. There’s a detailed example of using ogrinspect in the tutorial.
- --blank <blank_field(s)>¶
Use a comma separated list of OGR field names to add the blank=True keyword option to the field definition. Set with true to apply to all applicable fields.
- --decimal <decimal_field(s)>¶
- --geom-name <name>¶
Specifies the model attribute name to use for the geometry field. Defaults to 'geom'.
- --layer <layer>¶
- --name-field <name_field>¶
Generates a __unicode__ routine on the model that will return the the given field name.
Suppresses the from django.contrib.gis.db import models import statement.
- --null <null_field(s)>¶
Use a comma separated list of OGR field names to add the null=True keyword option to the field definition. Set with true to apply to all applicable fields.
The SRID to use for the geometry field. If not set, ogrinspect attempts to automatically determine of the SRID of the data source.
Having trouble? We'd like to help!
- Try the FAQ — it's got answers to many common questions.
- Search for information in the archives of the django-users mailing list, or post a question.
- Ask a question in the #django IRC channel, or search the IRC logs to see if it has been asked before.
- If you notice errors with this documentation, please open a ticket and let us know! Please only use the ticket tracker for criticisms and improvements on the docs. For tech support, use the resources above.