Ticket #4922: fieldtypes.diff
File fieldtypes.diff, 982 bytes (added by , 17 years ago) |
---|
-
django/core/serializers/python.py
22 22 23 23 def start_object(self, obj): 24 24 self._current = {} 25 self._field_types = {} 25 26 26 27 def end_object(self, obj): 27 28 self.objects.append({ 28 29 "model" : str(obj._meta), 29 30 "pk" : str(obj._get_pk_val()), 30 "fields" : self._current 31 "fields" : self._current, 32 "field_types": self._field_types 31 33 }) 32 34 self._current = None 35 self._field_types = None 33 36 34 37 def handle_field(self, obj, field): 35 38 self._current[field.name] = getattr(obj, field.name) 39 self._field_types[field.name] = field.get_internal_type() 36 40 37 41 def handle_fk_field(self, obj, field): 38 42 related = getattr(obj, field.name)