mirror of
https://github.com/django/django.git
synced 2025-01-03 15:06:09 +00:00
Fixed #2608 -- Generate correct SQL for multi-level foreign key relations.
Based on a patch from Gopal Narayanan. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5106 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f30ca6636b
commit
fb30e774f9
1
AUTHORS
1
AUTHORS
@ -164,6 +164,7 @@ answer newbie questions, and generally made Django that much better:
|
|||||||
Robin Munn <http://www.geekforgod.com/>
|
Robin Munn <http://www.geekforgod.com/>
|
||||||
Robert Myers <myer0052@gmail.com>
|
Robert Myers <myer0052@gmail.com>
|
||||||
Nebojša Dorđević
|
Nebojša Dorđević
|
||||||
|
Gopal Narayanan <gopastro@gmail.com>
|
||||||
Fraser Nevett <mail@nevett.org>
|
Fraser Nevett <mail@nevett.org>
|
||||||
Sam Newman <http://www.magpiebrain.com/>
|
Sam Newman <http://www.magpiebrain.com/>
|
||||||
Neal Norwitz <nnorwitz@google.com>
|
Neal Norwitz <nnorwitz@google.com>
|
||||||
|
@ -168,6 +168,8 @@ def _get_sql_model_create(model, known_models=set()):
|
|||||||
for f in opts.fields:
|
for f in opts.fields:
|
||||||
if isinstance(f, (models.ForeignKey, models.OneToOneField)):
|
if isinstance(f, (models.ForeignKey, models.OneToOneField)):
|
||||||
rel_field = f.rel.get_related_field()
|
rel_field = f.rel.get_related_field()
|
||||||
|
while isinstance(rel_field, (models.ForeignKey, models.OneToOneField)):
|
||||||
|
rel_field = rel_field.rel.get_related_field()
|
||||||
data_type = get_rel_data_type(rel_field)
|
data_type = get_rel_data_type(rel_field)
|
||||||
else:
|
else:
|
||||||
rel_field = f
|
rel_field = f
|
||||||
|
Loading…
Reference in New Issue
Block a user