Django

Code

Ticket #1268 (closed: wontfix)

Opened 4 years ago

Last modified 3 years ago

[magic-removal] [patch] Allow access to the current user outside of a request

Reported by: jkocherhans Assigned to: adrian
Milestone: Component: Core framework
Version: magic-removal Keywords:
Cc: upadhyay@gmail.com Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

current_user.diff (7.8 kB) - added by jkocherhans on 01/23/06 16:44:00.
initial attempt

Change History

01/23/06 16:44:00 changed by jkocherhans

  • attachment current_user.diff added.

initial attempt

02/13/06 07:09:15 changed by anonymous

  • cc set to upadhyay@gmail.com.

02/27/06 17:42:42 changed by jacob

  • status changed from new to closed.
  • resolution set to wontfix.

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

04/04/06 08:02:37 changed by Gacha

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

04/04/06 10:03:41 changed 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


Add/Change #1268 ([magic-removal] [patch] Allow access to the current user outside of a request)




Change Properties
Action