mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #1165 -- Fixed bug in generated CREATE TABLE statements where a primary key related to a PositiveIntegerField or PositiveSmallIntegerField. Thanks, avandorp@gmail.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1970 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e449e5c805
commit
2667ead885
1
AUTHORS
1
AUTHORS
@ -34,6 +34,7 @@ answer newbie questions, and generally made Django that much better:
|
|||||||
akaihola
|
akaihola
|
||||||
Andreas
|
Andreas
|
||||||
David Ascher <http://ascher.ca/>
|
David Ascher <http://ascher.ca/>
|
||||||
|
Arthur <avandorp@gmail.com>
|
||||||
James Bennett
|
James Bennett
|
||||||
Paul Bissex <http://e-scribe.com/>
|
Paul Bissex <http://e-scribe.com/>
|
||||||
Simon Blanchard
|
Simon Blanchard
|
||||||
|
@ -53,10 +53,11 @@ def _get_contenttype_insert(opts):
|
|||||||
def _is_valid_dir_name(s):
|
def _is_valid_dir_name(s):
|
||||||
return bool(re.search(r'^\w+$', s))
|
return bool(re.search(r'^\w+$', s))
|
||||||
|
|
||||||
# If the foreign key points to an AutoField, the foreign key should be an
|
# If the foreign key points to an AutoField, a PositiveIntegerField or a
|
||||||
# IntegerField, not an AutoField. Otherwise, the foreign key should be the same
|
# PositiveSmallIntegerField, the foreign key should be an IntegerField, not the
|
||||||
# type of field as the field to which it points.
|
# referred field type. Otherwise, the foreign key should be the same type of
|
||||||
get_rel_data_type = lambda f: (f.get_internal_type() == 'AutoField') and 'IntegerField' or f.get_internal_type()
|
# field as the field to which it points.
|
||||||
|
get_rel_data_type = lambda f: (f.get_internal_type() in ('AutoField', 'PositiveIntegerField', 'PositiveSmallIntegerField')) and 'IntegerField' or f.get_internal_type()
|
||||||
|
|
||||||
def get_sql_create(mod):
|
def get_sql_create(mod):
|
||||||
"Returns a list of the CREATE TABLE SQL statements for the given module."
|
"Returns a list of the CREATE TABLE SQL statements for the given module."
|
||||||
|
Loading…
Reference in New Issue
Block a user