1
0
mirror of https://github.com/django/django.git synced 2024-12-25 10:35:48 +00:00

Fixed dict randomization issue in inspectdb

This commit is contained in:
Claude Paroz 2013-01-31 22:21:24 +01:00
parent 7bbd17bf20
commit b757e7ae18

View File

@ -6,6 +6,7 @@ from optparse import make_option
from django.core.management.base import NoArgsCommand, CommandError from django.core.management.base import NoArgsCommand, CommandError
from django.db import connections, DEFAULT_DB_ALIAS from django.db import connections, DEFAULT_DB_ALIAS
from django.utils.datastructures import SortedDict
class Command(NoArgsCommand): class Command(NoArgsCommand):
@ -67,7 +68,7 @@ class Command(NoArgsCommand):
used_column_names = [] # Holds column names used in the table so far used_column_names = [] # Holds column names used in the table so far
for i, row in enumerate(connection.introspection.get_table_description(cursor, table_name)): for i, row in enumerate(connection.introspection.get_table_description(cursor, table_name)):
comment_notes = [] # Holds Field notes, to be displayed in a Python comment. comment_notes = [] # Holds Field notes, to be displayed in a Python comment.
extra_params = {} # Holds Field parameters such as 'db_column'. extra_params = SortedDict() # Holds Field parameters such as 'db_column'.
column_name = row[0] column_name = row[0]
is_relation = i in relations is_relation = i in relations
@ -191,7 +192,7 @@ class Command(NoArgsCommand):
description, this routine will return the given field type name, as description, this routine will return the given field type name, as
well as any additional keyword parameters and notes for the field. well as any additional keyword parameters and notes for the field.
""" """
field_params = {} field_params = SortedDict()
field_notes = [] field_notes = []
try: try: