Currently, I am overriding the save() method to keep records of all changes made to objects. I've created a simplified example below.
I have two questions: 1) Is there an obvious better way? 2) When comparing the 'status_id' fields, they always are unequal even when the status wasn't changed during modification. Any reason why? Using the shell, they both return int which compare equally. I'm using the following (simplified) models: ### start models.py ### from django.db import models class Note(models.Model): created = models.DateTimeField(auto_now_add=True) message = models.CharField(maxlength=1000) def __str__(self): return self.message class Admin: pass class Status(models.Model): name = models.CharField(maxlength=50) def __str__(self): return self.name class Admin: pass class Order(models.Model): created = models.DateTimeField(auto_now_add=True) customer_name = models.CharField(maxlength=100) status = models.ForeignKey(Status) def save(self): if self.id: # on update note = Note() note.message = "" orig = Order.objects.filter(pk=self.id)[0] for f in ['customer_name', 'status_id']: if self.__dict__[f] != orig.__dict__[f]: note.message += "%s was: %s; " % (f, orig.__dict__[f]) note.save() super(Order,self).save() def __str__(self): return self.customer_name class Admin: pass ### end models.py ### Thanks for your time. -- Matt H <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---