mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #12420. Now that OneToOneField allows assignment of None, stop guarding against it in ModelForms. Thanks, andrewsk.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12545 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -48,10 +48,6 @@ def construct_instance(form, instance, fields=None, exclude=None):
|
||||
continue
|
||||
if exclude and f.name in exclude:
|
||||
continue
|
||||
# OneToOneField doesn't allow assignment of None. Guard against that
|
||||
# instead of allowing it and throwing an error.
|
||||
if isinstance(f, models.OneToOneField) and cleaned_data[f.name] is None:
|
||||
continue
|
||||
# Defer saving file-type fields until after the other fields, so a
|
||||
# callable upload_to can use the values from other fields.
|
||||
if isinstance(f, models.FileField):
|
||||
|
||||
Reference in New Issue
Block a user