def revert_field(self, field_name):
		if field_name in self._meta._forward_fields_map:
			field = self._meta._forward_fields_map[field_name]
			
			if field.name in self._changed_fields:
				# Bypass our __setattr__ since we know what the result will be.
				super(BaseChangeTracker, self).__setattr__(field.name, self._changed_fields[field.name])
				self._changed_fields.pop(field.name)
			
			if field.attname in self._changed_fields:
				super(BaseChangeTracker, self).__setattr__(field.attname, self._changed_fields[field.attname])
				
				# If you don't have a hydrated instance and you set a related
				# field to None, the field cache is also set to None. Since
				# when reverting a dehydrated instance we only set the pk
				# attribute, we have to also clear the cache ourselves if the
				# instance in it is None or otherwise incorrect to restore
				# expected behavior.
				if field.is_relation:
					hydrated_old = getattr(self, getattr(self.__class__, field.name).cache_name, DoesNotExist)
					
					if hydrated_old is not DoesNotExist and (hydrated_old is None or hydrated_old.pk != self._changed_fields[field.attname]):
						delattr(self, getattr(self.__class__, field.name).cache_name)
				
				self._changed_fields.pop(field.attname)
dataset/ETHPy150Open karanlyons/django-save-the-change/save_the_change/mixins.py/TrackChanges.revert_field/original