1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #21097 - Added DatabaseFeature.can_introspect_autofield

This commit is contained in:
Michael Manfre
2013-09-12 10:03:29 -04:00
committed by Anssi Kääriäinen
parent 6feb75129f
commit c89d80e2cc
4 changed files with 13 additions and 5 deletions

View File

@@ -104,8 +104,11 @@ class Command(NoArgsCommand):
# Don't output 'id = meta.AutoField(primary_key=True)', because
# that's assumed if it doesn't exist.
if att_name == 'id' and field_type == 'AutoField(' and extra_params == {'primary_key': True}:
continue
if att_name == 'id' and extra_params == {'primary_key': True}:
if field_type == 'AutoField(':
continue
elif field_type == 'IntegerField(' and not connection.features.can_introspect_autofield:
comment_notes.append('AutoField?')
# Add 'null' and 'blank', if the 'null_ok' flag was present in the
# table description.

View File

@@ -627,6 +627,9 @@ class BaseDatabaseFeatures(object):
# which can't do it for MyISAM tables
can_introspect_foreign_keys = True
# Can the backend introspect an AutoField, instead of an IntegerField?
can_introspect_autofield = False
# Support for the DISTINCT ON clause
can_distinct_on_fields = False