Ticket #4922: fieldtypes.diff

File fieldtypes.diff, 982 bytes (added by gkelly@…, 17 years ago)
  • django/core/serializers/python.py

     
    2222       
    2323    def start_object(self, obj):
    2424        self._current = {}
     25        self._field_types = {}
    2526       
    2627    def end_object(self, obj):
    2728        self.objects.append({
    2829            "model"  : str(obj._meta),
    2930            "pk"     : str(obj._get_pk_val()),
    30             "fields" : self._current
     31            "fields" : self._current,
     32            "field_types": self._field_types
    3133        })
    3234        self._current = None
     35        self._field_types = None
    3336       
    3437    def handle_field(self, obj, field):
    3538        self._current[field.name] = getattr(obj, field.name)
     39        self._field_types[field.name] = field.get_internal_type()
    3640       
    3741    def handle_fk_field(self, obj, field):
    3842        related = getattr(obj, field.name)
Back to Top