I wouldn't use it.

For the admin, I find myself using javascript just fine to do what I
want. I usually have a middleware that sets the current user id as a
cookie, then run something like the following javascript in the admin
on window load: (requires jquery with cookie plugin)

    /* Highlight the currently logged in user. */
    function author_highlight() {
        var user_id = $.cookie("user_id");
        if (!user_id) {
            return;
        }
        var selects = $("select");
        for (var i=0; i < selects.length; i++) {
            var select = selects[i];
            if (select.id.match(/(author|user|creator|editor)/)) {
                for (var j=0; j < select.options.length; j++) {
                    if (select.options[j].value == user_id) {
                        select.options[j].selected = true;
                        return;
                    }
                }
            }
        }
    }

This keeps the python abstractions relatively unbroken. Note that this
may not be exactly what you want, but it illustrates the point that
you can do it in javascript.

-Mike


On Apr 3, 12:56 pm, Aljosa Mohorovic <[EMAIL PROTECTED]>
wrote:
> i'm using admin app and found myself in situation where i need to
> store current user when saving item so i've overwritten save method on
> model and with threadlocals middleware fetched current user.
>
> threadlocals middleware 
> url:http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser
>
> is this the best way to fetch current user outside views?
> any comments?
>
> Aljosa
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to