Opened 11 years ago

Closed 11 years ago

Last modified 9 years ago

#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: UI/UX:

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)

current_user.diff (7.8 KB) - added by jkocherhans 11 years ago.
initial attempt

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by jkocherhans

Attachment: current_user.diff added

initial attempt

comment:1 Changed 11 years ago by anonymous

Cc: upadhyay@… added

comment:2 Changed 11 years ago by Jacob

Resolution: wontfix
Status: newclosed

Thread locals seem too heavyweight for this situation; marking wontfix.

comment:3 Changed 10 years ago by Gacha

I applyed the patch, but how can I use it?

comment:4 Changed 10 years ago by jkocherhans

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

Note: See TracTickets for help on using tickets.
Back to Top