Take a look at http://code.google.com/p/django-reversion/ which may be
more than what you need, but certainly fills the bill for your general
use case.
On Nov 10, 1:03 pm, Tim <[EMAIL PROTECTED]> wrote:
> Basically, I want to be able to do something if the value of a field
> changes in a model.
Why not simple fetch `old version` of object from database and compare its
fields. For example:
def save(self, *args, **kwargs):
if self._get_pk_val():
old = self.__class__.objects.get(pk=self._get_pk_val()
for field in self.__class__._meta.fields:
old_value =
Basically, I want to be able to do something if the value of a field
changes in a model.
c = Category.objects.get(pk=1)
c.name = "New Name"
c.save()
At any point (when the model is saved, when the value is set, etc.) is
it possible to compare the old and new value? The first thought that
popped
3 matches
Mail list logo