#1268 closed enhancement (wontfix)
[magic-removal] [patch] Allow access to the current user outside of a request
Reported by: | jkocherhans | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | Core (Other) | Version: | magic-removal |
Severity: | normal | Keywords: | |
Cc: | upadhyay@… | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
A common request is for modified_by and added_by fields. It's not currently possible to do these automatically in django beacuse the model/manipulator is decoupled from the request object, and the request is the only place that has access to the current user. A couple of attempts to address this issue have been made in #1132 and #1164. These were generally rejected. A common solution for this problem is to store the current user in a thread local. This ticket uses that approach.
Attachments (1)
Change History (5)
by , 19 years ago
Attachment: | current_user.diff added |
---|
comment:1 by , 19 years ago
Cc: | added |
---|
comment:2 by , 19 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Thread locals seem too heavyweight for this situation; marking wontfix.
comment:4 by , 19 years ago
The django-users list is a more appropriate venue for this question. I wouldn't use this patch, it's certain to break as Django progresses. Another hack (but one that only works with the magic-removal branch) can be found here: http://lukeplant.me.uk/blog.php?id=1107301634
initial attempt