inspectdb.py 717 B

12345678910111213141516
  1. from django.core.management.commands.inspectdb import (
  2. Command as InspectDBCommand,
  3. )
  4. class Command(InspectDBCommand):
  5. db_module = 'django.contrib.gis.db'
  6. def get_field_type(self, connection, table_name, row):
  7. field_type, field_params, field_notes = super().get_field_type(connection, table_name, row)
  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(table_name, row)
  12. field_params.update(geo_params)
  13. return field_type, field_params, field_notes