diff options
| author | haxoza <prze.lewandowski@gmail.com> | 2015-11-14 17:38:27 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-02-19 14:18:53 -0500 |
| commit | 375e1cfe2b2e1c3c57f882147c34902c6e8189ac (patch) | |
| tree | 39150c535d8bdcb44ca084b1e852f7551c82d653 /django/forms | |
| parent | 5c31d8d189ec24d83e25e2c560860f70307b431e (diff) | |
Fixed #25349 -- Allowed a ModelForm to unset a fields with blank=True, required=False.
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/models.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/django/forms/models.py b/django/forms/models.py index 8c0f2e97a6..8e8c8cfb55 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -376,11 +376,6 @@ class BaseModelForm(BaseForm): exclude = self._get_validation_exclusions() - try: - self.instance = construct_instance(self, self.instance, opts.fields, exclude) - except ValidationError as e: - self._update_errors(e) - # Foreign Keys being used to represent inline relationships # are excluded from basic field value validation. This is for two # reasons: firstly, the value may not be supplied (#12507; the @@ -393,6 +388,11 @@ class BaseModelForm(BaseForm): exclude.append(name) try: + self.instance = construct_instance(self, self.instance, opts.fields, opts.exclude) + except ValidationError as e: + self._update_errors(e) + + try: self.instance.full_clean(exclude=exclude, validate_unique=False) except ValidationError as e: self._update_errors(e) |
