Wednesday, March 30, 2011

Re: model manager and request


This sort of thing comes up so frequently on this list that we've all
seen those answers dozens of times, although not usually in so concise
a manner.

My question, to which there seems to be no answer, is what a good
approach to do something that I know (from spending a long time on
this list) is also in high demand: Storing audit information.

Simple requirement:
Store, request.user, and changes to a model
automatically on post_save.

The "correct" solutions do not work. If you're using any pluggable
apps at all you have to fork them or not log them. Refactoring is not
an option.

I understand why request information is simply not in scope in This isn't a rant or a demand for a fundamental change to
the way Django works. I'm just looking for either:

1. A definitive "This is currently impossible in Django."

2. This is possible with this clever hack/middleware/pseudocode/whatever.

Obviously this method (should it exist) allows a lot of bad designs in
Django apps. But for the case of applying automatic logging in a
Django project, it seems like a reasonable desire. Especially given
that, as Django is a Web framework, there is always a request and
always a user (even if it's an anonymous user).

Your thoughts would be greatly appreciated. I'll also be attending
your webinar tomorrow. If you find this question to be in scope or
have extra time then I'd love to see it addressed.

Thank you,

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment