Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #12190 -- Corrected a regression in the ability to instantiate …

…ForeignKeys outside of models. Thanks to jittat for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11730 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 70f9a4f6ceb1bc4a33714e3b1cfb99175e2fcf3f 1 parent ef65854
Russell Keith-Magee authored November 10, 2009
4  django/db/models/fields/related.py
@@ -695,6 +695,10 @@ def __init__(self, to, to_field=None, rel_class=ManyToOneRel, **kwargs):
6  tests/regressiontests/many_to_one_regress/models.py
@@ -167,4 +167,10 @@ def __unicode__(self):
167 167
     ...
168 168
 ValueError: Cannot assign "<Child: Child object>": "Child.parent" must be a "Parent" instance.
169 169
 
  170
+# Regression for #12190 -- Should be able to instantiate a FK
  171
+# outside of a model, and interrogate its related field.
  172
+>>> cat = models.ForeignKey(Category)
  173
+>>> cat.rel.get_related_field().name
  174
+'id'
  175
+
170 176
 """}

0 notes on commit 70f9a4f

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