1
0
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 from 45e049937. Refs #13776.

Backport of 65a1055a3 from master.
This commit is contained in:
Claude Paroz
2015-09-19 14:23:55 +02:00
parent 5023d63f85
commit 158b0a2837
3 changed files with 12 additions and 9 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):