diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2007-09-15 21:42:51 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2007-09-15 21:42:51 +0000 |
| commit | 5ce2e6c2c827cf877f73bf0e42e6afb7e6a71ccf (patch) | |
| tree | 8c8c2fb8329e2db7dbfcf2c47026a11ff079e5c5 /docs/databrowse.txt | |
| parent | ea9cd5421382c047e2cc140bd6736b54ba660793 (diff) | |
queryset-refactor: Merged to [6220]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6337 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/databrowse.txt')
| -rw-r--r-- | docs/databrowse.txt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/docs/databrowse.txt b/docs/databrowse.txt index 81e9e8e83b..72e1c71720 100644 --- a/docs/databrowse.txt +++ b/docs/databrowse.txt @@ -58,4 +58,29 @@ How to use Databrowse 4. Run the Django server and visit ``/databrowse/`` in your browser. +Requiring user login +==================== + +You can restrict access to logged-in users with only a few extra lines of +code. Simply add the following import to your URLconf:: + + from django.contrib.auth.decorators import login_required + +Then modify the URLconf so that the ``databrowse.site.root`` view is decorated +with ``login_required``:: + + (r'^databrowse/(.*)', login_required(databrowse.site.root)), + +If you haven't already added support for user logins to your URLconf, as +described in the `user authentication docs`_, then you will need to do so +now with the following mapping:: + + (r'^accounts/login/$', 'django.contrib.auth.views.login'), + +The final step is to create the login form required by +``django.contrib.auth.views.login``. The `user authentication docs`_ +provide full details and a sample template that can be used for this +purpose. + .. _template loader docs: ../templates_python/#loader-types +.. _user authentication docs: ../authentication/ |
