Suppose I have a Django model as follows:
class Person(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
Somewhere I have an instance p, and I make some changes to it.
p.first_name = 'new first name'
Due to some reason, I wish to revert all the changes I made to this instance. One way I can think of reverting is as follows:
p = Person.objects.get(pk=p.pk)
The above code depends upon the Model class name. Is there any simpler model independent way to do this?
Given an instance p,