On 2/20/07, Honza Kr�l <[EMAIL PROTECTED]> wrote:
> On 2/20/07, Benedict Verheyen <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > i have some tables that i want to link with an authorized user.
> > Right now i use the login mechanism of django.
> >
> > 1. Is it possible to specify a foreign_key to the auth_user database?
> > If not, what is the best way to have a "user" field in a table
> > that refers to a logged in user?
>
> Sure, its just a django application with models and stuff...
>
> >
> > 2. How can i get the user id and username available in my templates.
> > I would like to display the current logged in user and use the id
> > to automatically fill in, in the field specified in 1.
>
> to have it in your templates simply use the auth middleware and add
> django.core.context_processors.auth to your TEMPLATE_CONTEXT_PROCESSORS

to have the user available outside templates and views (models etc.) see

http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser

>
> >
> > Thanks,
> > Benedict
> >
> > > >
> >
>
>
> --
> Honza Kr�l
> E-Mail: [EMAIL PROTECTED]
> ICQ#:   107471613
> Phone:  +420 606 678585
>


-- 
Honza Kr�l
E-Mail: [EMAIL PROTECTED]
ICQ#:   107471613
Phone:  +420 606 678585

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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