I know that queryset.update does not call .save() for each instance and
I know why. I even agree with it :)

However, I'd like to have a bit more control over what update() does,
e.g. for auditing purposes. I know that I can simply write a few lines
of code near every update() call to do what I want, but that violates
DRY.

I have created ticket #13021 and uploaded a patch that adds a few new
features:

* pre_update and post_update signals
* a pre_update method for Field that does nothing
* a pre_update method for DateField for auto_now magic
* an update() method for Model that calls pre_update for all fields. 
  This method is a classmethod
* a patched QuerySet.update() that
  - Sends the pre_update and post_update signals
  - Calls the models update method to update the kwargs dict

The patch is untested, but should give a good idea of what I want to
achieve. Is this approach suitable for inclusion in django? If so, I
will complete the patch, add tests and documentation and will submit it
for inclusion at the appropriate time.

Thanks in advance for considering and commenting,
-- 
Dennis K.

The universe tends towards maximum irony. Don't push it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to