If you look at the form's _changed_data attribute, it will give you a list of the fields that have changed. That should tell you what is causing has_changed() to return True.
Margie On Jan 6, 6:50 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Wed, Jan 6, 2010 at 7:34 PM, Alastair Campbell <ala...@gmail.com> wrote: > > Hi everyone, > > > I've been looking for a simple way to send an email when a user > > updates their profile. > > > After some digging I found form.has_changed() which appears to fit the > > bill. However, it always seems to return true, so I could end up > > bombarding our elderly admin lady with lots of useless emails. > > > I'm using a simple model form (with a sub-set of the available > > fields), rendered in the default manner, no hidden fields or anything. > > If I open the page, hit save, if form.has_changed(): runs. > > > Is there anything else that might cause has_changed to be true? > > has_changed() returns True if the bound data of the form differs from the > initial data. It does work and it does not always return True. Without > specifics of the code you are using to construct your form I'm not sure why > it is always seeming to return True in your case. > > Karen
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.