mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[1.8.x] 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 from45e049937. Refs #13776. Backport of65a1055a3from master.
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user