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'):