Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 5, 2005 00:38:44

Flavio C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

getting currently logged-in user


according tohttp://www.djangoproject.com/documentation/request_response/I can
access to currently logged-in user:

<blockquote>
user
A django.models.auth.users.User object representing the currently
logged-in user.
</blockquote>

But dopcumentation tell no more than that about this.
How can I access to id of current logged-in user in a model?

for example:

from django.models import auth

class Article(meta.Model):
title = meta.CharField(maxlength=255)
content = meta.TextField()
author_name = meta.CharField(maxlength=50, default=auth.users.User.id)
creation_date = meta.DateTimeField('creation date', auto_now_add=True)

Offline

#2 Nov. 5, 2005 00:54:02

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

getting currently logged-in user


On 11/4/05, Flavio Curella <> wrote:
> according to
>http://www.djangoproject.com/documentation/request_response/I can
> access to currently logged-in user:
>
> <blockquote>
> user
> A django.models.auth.users.User object representing the currently
> logged-in user.
> </blockquote>
>
> But dopcumentation tell no more than that about this.
> How can I access to id of current logged-in user in a model?

The documentation you cite refers to request objects. Models don't
know anything about requests or responses -- they're decoupled from
the concept of Web applications.

As of now, there's no way to specify that the currently logged-in user
should be stored in a field in the admin interface.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

Board footer

Moderator control

Enjoy the 20th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support