mirror of https://github.com/django/django.git
Fixed #8651: correctly deserialize objects with 0 for pk/fk.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8676 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
195420259a
commit
9f59fc5560
|
@ -84,7 +84,7 @@ def Deserializer(object_list, **options):
|
|||
|
||||
# Handle FK fields
|
||||
elif field.rel and isinstance(field.rel, models.ManyToOneRel):
|
||||
if field_value:
|
||||
if field_value is not None:
|
||||
data[field.attname] = field.rel.to._meta.get_field(field.rel.field_name).to_python(field_value)
|
||||
else:
|
||||
data[field.attname] = None
|
||||
|
|
|
@ -261,6 +261,10 @@ The end."""),
|
|||
|
||||
(fk_obj, 460, FKDataToO2O, 300),
|
||||
|
||||
# Regression test for #8651 -- FK = 0
|
||||
(data_obj, 0, Anchor, "Anchor 0"),
|
||||
(fk_obj, 465, FKData, 0),
|
||||
|
||||
(im2m_obj, 470, M2MIntermediateData, None),
|
||||
|
||||
#testing post- and prereferences and extra fields
|
||||
|
|
Loading…
Reference in New Issue