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:
Jacob Kaplan-Moss 2006-11-07 04:56:50 +00:00
parent e39a8e947e
commit febe05b9ef
1 changed files with 1 additions and 1 deletions

View File

@ -76,7 +76,7 @@ def Deserializer(object_list, **options):
m2m_data[field.name] = field.rel.to._default_manager.in_bulk(field_value).values() m2m_data[field.name] = field.rel.to._default_manager.in_bulk(field_value).values()
# Handle FK fields # 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: try:
data[field.name] = field.rel.to._default_manager.get(pk=field_value) data[field.name] = field.rel.to._default_manager.get(pk=field_value)
except field.rel.to.DoesNotExist: except field.rel.to.DoesNotExist: