Fixed #2921: deserialization no longer failes on NULL primary keys. Thanks, mir@noris.de.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4043 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e39a8e947e
commit
febe05b9ef
|
@ -76,7 +76,7 @@ def Deserializer(object_list, **options):
|
|||
m2m_data[field.name] = field.rel.to._default_manager.in_bulk(field_value).values()
|
||||
|
||||
# Handle FK fields
|
||||
elif field.rel and isinstance(field.rel, models.ManyToOneRel):
|
||||
elif field.rel and isinstance(field.rel, models.ManyToOneRel) and field_value is not None:
|
||||
try:
|
||||
data[field.name] = field.rel.to._default_manager.get(pk=field_value)
|
||||
except field.rel.to.DoesNotExist:
|
||||
|
|
Loading…
Reference in New Issue