The important question here is, what are you trying to achieve, outside of
the functionality itself? Are you trying to log changes to provide an audit
trail? If so, there are tools for that.


Cheers,
AT

On Wed, Jan 11, 2012 at 2:53 PM, Jeff <jbla...@mitre.org> wrote:

> Matt,
>
> On Jan 10, 5:57 pm, Matt Schinckel <m...@schinckel.net> wrote:
> > The way I generally do this type of thing
> > is:https://gist.github.com/1591723
>
> Thanks for the reply!
>
> This looked awfully similar to my logic (although yours is 10x more
> clean),
> but I was excited to implement it this morning.  After doing so, I am
> seeing
> the same behavior:  old_version.foo_field is matching self.foo_field
> no matter
> what I do to foo_field.
>
> https://gist.github.com/1595587
>
> For example, device 'mote' in the database shows no values for field
> netgroups.
> Viewing 'mote' in the Django admin interface, I add a netgroup called
> 'testnetgroup'
> from the list of netgroups available.  I click save.  Viewing 'mote'
> again shows that
> the modification took place -- mote references netgroup
> 'testnetgroup'.
>
> However, the log from that 'save' shows the following bogus
> information:
>
> Device : in custom .save()
> Device : old_version.netgroups.values(): []
> Device : self.netgroups.values(): []
> Device : old does NOT match new
>
> 1. The "new" value is showing incorrectly as an empty list.
> 2. The test shows them the same, but is reporting that they don't even
> match
>
> Viewing device 'mote' again, *removing* the only netgroup from it
> (testnetgroup)
> and re-saving reports similar bogus info:
>
> Device : in custom .save()
> Device : old_version.netgroups.values(): [{'name': u'testnetgroup',
> 'desc': u''}]
> Device : self.netgroups.values(): [{'name': u'testnetgroup', 'desc':
> u''}]
> Device : old does NOT match new
>
> 1. The "new" value is showing incorrectly as [{'name':
> u'testnetgroup', 'desc': u''}] and
>     should be an empty list.
> 2. The test shows them the same, but is reporting that they don't even
> match
>
> This should have said:
>
> Device : in custom .save()
> Device : old_version.netgroups.values(): [{'name': u'testnetgroup',
> 'desc': u''}]
> Device : self.netgroups.values(): []
> Device : old does NOT match new
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to