summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorBrian Rosner <brosner@gmail.com>2009-10-19 19:21:08 +0000
committerBrian Rosner <brosner@gmail.com>2009-10-19 19:21:08 +0000
commitbde4c6d9955b2df78aed2f7ac540b017e4de3584 (patch)
tree05447ec7d2865f00e113e6adde236ab469dfe0c8 /django
parentfb8653ad0e4f4a927c82ea8009dbd3877412e4db (diff)
[1.1.X] Moved the call to _get_foreign_key to run in all cases catching incorrect inline setup sooner.
Backport of [11631] from trunk git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@11633 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/contrib/admin/validation.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/contrib/admin/validation.py b/django/contrib/admin/validation.py
index 758090f896..595b951b9e 100644
--- a/django/contrib/admin/validation.py
+++ b/django/contrib/admin/validation.py
@@ -149,6 +149,9 @@ def validate(cls, model):
validate_inline(inline, 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)
@@ -169,7 +172,6 @@ def validate_inline(cls, parent, parent_model):
# exclude
if hasattr(cls, 'exclude') and cls.exclude:
- fk = _get_foreign_key(parent_model, cls.model, fk_name=cls.fk_name, can_fail=True)
if fk and fk.name in cls.exclude:
raise ImproperlyConfigured("%s cannot exclude the field "
"'%s' - this is the foreign key to the parent model "