You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

inspectdb.py 750B

1234567891011121314151617
  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. geo_col = row[0]
  10. # Getting a more specific field type and any additional parameters
  11. # from the `get_geometry_type` routine for the spatial backend.
  12. field_type, geo_params = connection.introspection.get_geometry_type(table_name, geo_col)
  13. field_params.update(geo_params)
  14. return field_type, field_params, field_notes