On Feb 9, 9:41 am, Rune Kaagaard <rumi...@gmail.com> wrote:
>         has_changed = False
>         if resource.user.email != request.POST['email']:
>             resource.user.email = request.POST['email']
>             has_changed = True
>         if resource.user.is_active != request.POST['is_active']:
>             resource.user.is_active = request.POST['is_active']
>             has_changed = True
>         if has_changed:
>             resource.user.save()

Why are you only saving if you've made a change? (Just make sure you
aren't optimizing prematurely.)

A (django) form will track changes for you. If you can't use a form
for some reason, you might look at e.g. django-dirtyfields*

* http://code.activestate.com/pypm/django-dirtyfields/

-- 
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