commands.txt 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. .. ref-geodjango-admin:
  2. =============================
  3. GeoDjango Management Commands
  4. =============================
  5. inspectdb
  6. =========
  7. .. describe:: django-admin.py inspectdb
  8. When :mod:`django.contrib.gis` is in your :setting:`INSTALLED_APPS`, the
  9. :djadmin:`inspectdb` management command is overridden with one from GeoDjango.
  10. The overridden command is spatially-aware, and places geometry fields in the
  11. auto-generated model definition, where appropriate.
  12. ogrinspect <data_source> <model_name>
  13. =====================================
  14. .. django-admin:: ogrinspect
  15. The ``ogrinpsect`` management command will inspect the given OGR-compatible
  16. :class:`~django.contrib.gis.gdal.DataSource` (e.g., a shapefile) and will
  17. output a GeoDjango model with the given model name. There's a detailed example
  18. of using ``ogrinspect`` :ref:`in the tutorial <ogrinspect-intro>`.
  19. .. django-admin-option:: --blank <blank_field(s)>
  20. Use a comma separated list of OGR field names to add the ``blank=True``
  21. keyword option to the field definition. Set with ``true`` to apply
  22. to all applicable fields.
  23. .. django-admin-option:: --decimal <decimal_field(s)>
  24. Use a comma separated list of OGR float fields to generate
  25. :class:`~django.db.models.DecimalField` instead of the default
  26. :class:`~django.db.models.FloatField`. Set to ``true`` to apply to all
  27. OGR float fields.
  28. .. django-admin-option:: --geom-name <name>
  29. Specifies the model attribute name to use for the geometry field.
  30. Defaults to ``'geom'``.
  31. .. django-admin-option:: --layer <layer>
  32. The key for specifying which layer in the OGR
  33. :class:`~django.contrib.gis.gdal.DataSource` source to use.
  34. Defaults to 0 (the first layer). May be an integer or a string identifier
  35. for the :class:`~django.contrib.gis.gdal.Layer`.
  36. .. django-admin-option:: --mapping
  37. Automatically generate a mapping dictionary for use with
  38. :class:`~django.contrib.gis.utils.LayerMapping`.
  39. .. django-admin-option:: --multi-geom
  40. When generating the geometry field, treat it as a geometry collection.
  41. For example, if this setting is enabled then a
  42. :class:`~django.contrib.gis.db.models.MultiPolygonField` will be placed
  43. in the generated model rather than
  44. :class:`~django.contrib.gis.db.models.PolygonField`.
  45. .. django-admin-option:: --name-field <name_field>
  46. Generates a ``__unicode__`` routine on the model that will return the
  47. the given field name.
  48. .. django-admin-option:: --no-imports
  49. Suppresses the ``from django.contrib.gis.db import models`` import statement.
  50. .. django-admin-option:: --null <null_field(s)>
  51. Use a comma separated list of OGR field names to add the ``null=True``
  52. keyword option to the field definition. Set with ``true`` to apply to
  53. all applicable fields.
  54. .. django-admin-option:: --srid
  55. The SRID to use for the geometry field. If not set, ``ogrinspect`` attempts
  56. to automatically determine of the SRID of the data source.