Re: Detecting changed fields when saving an object

2007-10-30 Thread Ben
On Oct 30, 10:33 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > That's the basic idea, anyway. Hope this helps. Spot on, it was overriding __init__() that does it :) Many thanks, Ben. --~--~-~--~~~---~--~~ You received this message because you are subscribed t

Re: Detecting changed fields when saving an object

2007-10-30 Thread Marty Alchin
On 10/30/07, Ben <[EMAIL PROTECTED]> wrote: > I don't specifically need the before value, I need to know which of > the fields have changed. Okay, well, it still raises the same question, anyway. But, regardless, you pretty much have two options: - Store the values when the object is instantiat

Re: Detecting changed fields when saving an object

2007-10-30 Thread Ben
On Oct 30, 10:07 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > Is there a particular reason you need the before and after, instead of > just the after? Getting the before values would either require an > additional query during your save, or you'd have to overload the > __init__ method to store

Re: Detecting changed fields when saving an object

2007-10-30 Thread Marty Alchin
On 10/30/07, Ben <[EMAIL PROTECTED]> wrote: > Actually, that's given me ideas but I can't seem to work out how to do > what I want. That works by simply storing the values after the change > each time the model is updated. However, I don't seem to have both the > before and after values in a singl

Re: Detecting changed fields when saving an object

2007-10-30 Thread Ben
On Oct 30, 7:31 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 10/30/07, Ben <[EMAIL PROTECTED]> wrote: > > > I'm trying to create an audit trail for a particular model, capturing > > all changes made on the objects. > > You might want to read this: > > http://code.djangoproject.com/wiki/Audi

Re: Detecting changed fields when saving an object

2007-10-30 Thread Ben
On Oct 30, 7:31 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 10/30/07, Ben <[EMAIL PROTECTED]> wrote: > > > I'm trying to create an audit trail for a particular model, capturing > > all changes made on the objects. > > You might want to read this: > > http://code.djangoproject.com/wiki/Audi

Re: Detecting changed fields when saving an object

2007-10-30 Thread James Bennett
On 10/30/07, Ben <[EMAIL PROTECTED]> wrote: > I'm trying to create an audit trail for a particular model, capturing > all changes made on the objects. You might want to read this: http://code.djangoproject.com/wiki/AuditTrail -- "Bureaucrat Conrad, you are technically correct -- the best kind

Detecting changed fields when saving an object

2007-10-30 Thread Ben
I'm trying to create an audit trail for a particular model, capturing all changes made on the objects. My immediate idea was to subclass the save() method on the model and compare the values both before and after calling the parent save method. This would work, but it would mean I would have to u