inspectdb.py 760 B

123456789101112131415161718
  1. from django.core.management.commands.inspectdb import Command as InspectDBCommand
  2. class Command(InspectDBCommand):
  3. db_module = "django.contrib.gis.db"
  4. def get_field_type(self, connection, table_name, row):
  5. field_type, field_params, field_notes = super().get_field_type(
  6. connection, table_name, row
  7. )
  8. if field_type == "GeometryField":
  9. # Getting a more specific field type and any additional parameters
  10. # from the `get_geometry_type` routine for the spatial backend.
  11. field_type, geo_params = connection.introspection.get_geometry_type(
  12. table_name, row
  13. )
  14. field_params.update(geo_params)
  15. return field_type, field_params, field_notes