From febe05b9eff84ab1d1ec2af61f6cd8337422731a Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Tue, 7 Nov 2006 04:56:50 +0000 Subject: [PATCH] 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 --- django/core/serializers/python.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/core/serializers/python.py b/django/core/serializers/python.py index 4181bc7f2b..859816c226 100644 --- a/django/core/serializers/python.py +++ b/django/core/serializers/python.py @@ -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: