mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
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:
parent
c07f9fef39
commit
65a1055a36
3 changed files with 12 additions and 5 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue