src/reversion/models.py
def field_dict(self):
        """
        A dictionary mapping field names to field values in this version
        of the model.

        This method will follow parent links, if present.
        """
        if not hasattr(self, '_field_dict_cache'):
            object_version = self.object_version
            obj = object_version.object
            result = {}
            for field in obj._meta.fields:
                result[field.name] = field.value_from_object(obj)
            result.update(object_version.m2m_data)
            # Add parent data.
            for parent_class, field in obj._meta.concrete_model._meta.parents.items():
                if obj._meta.proxy and parent_class == obj._meta.concrete_model:
                    continue
                content_type = ContentType.objects.get_for_model(parent_class)
                if field:
                    parent_id = force_text(getattr(obj, field.attname))
                else:
                    parent_id = obj.pk
                try:
                    parent_version = Version.objects.get(revision__id=self.revision_id,
                                                         content_type=content_type,
                                                         object_id=parent_id)
                except Version.DoesNotExist:  # pragma: no cover
                    pass
                else:
                    result.update(parent_version.field_dict)
            setattr(self, '_field_dict_cache', result)
        return getattr(self, '_field_dict_cache')

        A dictionary mapping field names to field values in this version
        of the model.

        This method will follow parent links, if present.
        
A dictionary mapping field names to field values in this version
of the model.

This method will follow parent links, if present.
A dictionary mapping field names to field values in this version of the model . This method will follow parent links if present .
def field_dict(self):
        if not hasattr(self, '_field_dict_cache'):
            object_version = self.object_version
            obj = object_version.object
            result = {}
            for field in obj._meta.fields:
                result[field.name] = field.value_from_object(obj)
            result.update(object_version.m2m_data)
            for parent_class, field in obj._meta.concrete_model._meta.parents.items():
                if obj._meta.proxy and parent_class == obj._meta.concrete_model:
                    continue
                content_type = ContentType.objects.get_for_model(parent_class)
                if field:
                    parent_id = force_text(getattr(obj, field.attname))
                else:
                    parent_id = obj.pk
                try:
                    parent_version = Version.objects.get(revision__id=self.revision_id,
                                                         content_type=content_type,
                                                         object_id=parent_id)
                except Version.DoesNotExist:  
                    pass
                else:
                    result.update(parent_version.field_dict)
            setattr(self, '_field_dict_cache', result)
        return getattr(self, '_field_dict_cache')
def field_dict ( self ) : if not hasattr ( self , '_field_dict_cache' ) : object_version = self . object_version obj = object_version . object result = { } for field in obj . _meta . fields : result [ field . name ] = field . value_from_object ( obj ) result . update ( object_version . m2m_data ) for parent_class , field in obj . _meta . concrete_model . _meta . parents . items ( ) : if obj . _meta . proxy and parent_class == obj . _meta . concrete_model : continue content_type = ContentType . objects . get_for_model ( parent_class ) if field : parent_id = force_text ( getattr ( obj , field . attname ) ) else : parent_id = obj . pk try : parent_version = Version . objects . get ( revision__id = self . revision_id , content_type = content_type , object_id = parent_id ) except Version . DoesNotExist : pass else : result . update ( parent_version . field_dict ) setattr ( self , '_field_dict_cache' , result ) return getattr ( self , '_field_dict_cache' )
A dictionary mapping field names to field values in this version
of the model.
A dictionary mapping field names to field values in this version of the model .
"""
        A dictionary mapping field names to field values in this version
        of the model.

        This method will follow parent links, if present.
        """ # Add parent data. # pragma: no cover
self