Opened 18 years ago

Closed 18 years ago

Last modified 17 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: 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)

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

Download all attachments as: .zip

Change History (5)

by jkocherhans, 18 years ago

Attachment: current_user.diff added

initial attempt

comment:1 by anonymous, 18 years ago

Cc: upadhyay@… added

comment:2 by Jacob, 18 years ago

Resolution: wontfix
Status: newclosed

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

comment:3 by Gacha, 18 years ago

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

comment:4 by jkocherhans, 18 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

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