magic-removal: Merged to [2300]

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2301 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-02-10 21:35:29 +00:00
parent 021b38a52c
commit d43d498ba2
5 changed files with 29 additions and 1 deletions

View file

@ -228,6 +228,21 @@ information.
.. _request objects: http://www.djangoproject.com/documentation/request_response/#httprequest-objects
.. _session documentation: http://www.djangoproject.com/documentation/sessions/
How to log a user in
--------------------
To log a user in, do the following within a view::
from django.models.auth import users
request.session[users.SESSION_KEY] = some_user.id
Because this uses sessions, you'll need to make sure you have
``SessionMiddleware`` enabled. See the `session documentation`_ for more
information.
This assumes ``some_user`` is your ``User`` instance. Depending on your task,
you'll probably want to make sure to validate the user's username and password.
Limiting access to logged-in users
----------------------------------

View file

@ -45,6 +45,12 @@ It implements the following standard dictionary methods:
* ``get(key, default=None)``
Example: ``fav_color = request.session.get('fav_color', 'red')``
* ``keys()``
**New in Django development version.**
* ``items()``
**New in Django development version.**
It also has these three methods:
* ``set_test_cookie()``