Fixed #25431 -- Readded inline foreign keys to modelformset instances

Too much field exclusions in form's construct_instance() in _post_clean()
could lead to some unexpected missing ForeignKey values.
Fixes a regression from 45e049937. Refs #13776.
This commit is contained in:
Claude Paroz 2015-09-19 14:23:55 +02:00
parent c07f9fef39
commit 65a1055a36
3 changed files with 12 additions and 5 deletions

View file

@ -37,6 +37,10 @@ class Book(models.Model):
def __str__(self):
return self.title
def clean(self):
# Ensure author is always accessible in clean method
assert self.author.name is not None
@python_2_unicode_compatible
class BookWithCustomPK(models.Model):