From 0d1177ae99a493272b2ef6982e4adc7141f15f72 Mon Sep 17 00:00:00 2001 From: Brian Rosner Date: Fri, 23 Oct 2009 20:47:29 +0000 Subject: [PATCH] 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 --- django/contrib/admin/validation.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/django/contrib/admin/validation.py b/django/contrib/admin/validation.py index 595b951b9e0..05e5c6d3008 100644 --- a/django/contrib/admin/validation.py +++ b/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'):