Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #2608 -- Generate correct SQL for multi-level foreign key relat…

…ions.

Based on a patch from Gopal Narayanan.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5106 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit fb30e774f91fb91372b0a5a3e707fbbd1996da83 1 parent f30ca66
Malcolm Tredinnick authored April 27, 2007
1  AUTHORS
@@ -164,6 +164,7 @@ answer newbie questions, and generally made Django that much better:
164 164
     Robin Munn <http://www.geekforgod.com/>
165 165
     Robert Myers <myer0052@gmail.com>
166 166
     Nebojša Dorđević
  167
+    Gopal Narayanan <gopastro@gmail.com>
167 168
     Fraser Nevett <mail@nevett.org>
168 169
     Sam Newman <http://www.magpiebrain.com/>
169 170
     Neal Norwitz <nnorwitz@google.com>
2  django/core/management.py
@@ -168,6 +168,8 @@ def _get_sql_model_create(model, known_models=set()):
168 168
     for f in opts.fields:
169 169
         if isinstance(f, (models.ForeignKey, models.OneToOneField)):
170 170
             rel_field = f.rel.get_related_field()
  171
+            while isinstance(rel_field, (models.ForeignKey, models.OneToOneField)):
  172
+                rel_field = rel_field.rel.get_related_field()
171 173
             data_type = get_rel_data_type(rel_field)
172 174
         else:
173 175
             rel_field = f

0 notes on commit fb30e77

Please sign in to comment.
Something went wrong with that request. Please try again.