(self, field)
return self.saved_data.get(field)
Returns currently saved value of given field
Returns currently saved value of given field
Returns currently saved value of given field
def previous(self, field):
        """Returns currently saved value of given field"""

        # handle deferred fields that have not yet been loaded from the database
        if self.instance.pk and field in self.deferred_fields and field not in self.saved_data:

            # if the field has not been assigned locally, simply fetch and un-defer the value
            if field not in self.instance.__dict__:
                self.get_field_value(field)

            # if the field has been assigned locally, store the local value, fetch the database value,
            # store database value to saved_data, and restore the local value
            else:
                current_value = self.get_field_value(field)
                self.instance.refresh_from_db(fields=[field])
                self.saved_data[field] = lightweight_deepcopy(self.get_field_value(field))
                setattr(self.instance, self.field_map[field], current_value)

        return self.saved_data.get(field)
def previous ( self , field ) : # handle deferred fields that have not yet been loaded from the database if self . instance . pk and field in self . deferred_fields and field not in self . saved_data : # if the field has not been assigned locally, simply fetch and un-defer the value if field not in self . instance . __dict__ : self . get_field_value ( field ) # if the field has been assigned locally, store the local value, fetch the database value, # store database value to saved_data, and restore the local value else : current_value = self . get_field_value ( field ) self . instance . refresh_from_db ( fields = [ field ] ) self . saved_data [ field ] = lightweight_deepcopy ( self . get_field_value ( field ) ) setattr ( self . instance , self . field_map [ field ] , current_value ) return self . saved_data . get ( field )