Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moved _get_foreign_key call after testing for fk_name fixing a broken…

… test.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11643 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 0d1177ae99a493272b2ef6982e4adc7141f15f72 1 parent fa6ca07
@brosner brosner authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 django/contrib/admin/validation.py
View
5 django/contrib/admin/validation.py
@@ -150,14 +150,15 @@ def validate(cls, model):
def validate_inline(cls, parent, parent_model):
- fk = _get_foreign_key(parent_model, cls.model, fk_name=cls.fk_name, can_fail=True)
-
# model is already verified to exist and be a Model
if cls.fk_name: # default value is None
f = get_field(cls, cls.model, cls.model._meta, 'fk_name', cls.fk_name)
if not isinstance(f, models.ForeignKey):
raise ImproperlyConfigured("'%s.fk_name is not an instance of "
"models.ForeignKey." % cls.__name__)
+
+ fk = _get_foreign_key(parent_model, cls.model, fk_name=cls.fk_name, can_fail=True)
+
# extra = 3
# max_num = 0
for attr in ('extra', 'max_num'):
Please sign in to comment.
Something went wrong with that request. Please try again.