Ticket #2894: deserialize_none_fk.diff
File deserialize_none_fk.diff, 909 bytes (added by , 18 years ago) |
---|
-
django/core/serializers/xml_serializer.py
166 166 # If it doesn't exist, set the field to None (which might trigger 167 167 # validation error, but that's expected). 168 168 RelatedModel = self._get_model_from_node(node, "to") 169 return RelatedModel.objects.get(pk=getInnerText(node).strip().encode(self.encoding)) 169 # Check if there is a child node named 'None', returning None if so. 170 if len(node.childNodes) == 1 and node.childNodes[0].nodeName == 'None': 171 return None 172 else: 173 return RelatedModel.objects.get(pk=getInnerText(node).strip().encode(self.encoding)) 170 174 171 175 def _handle_m2m_field_node(self, node): 172 176 """