Ticket #4061: databrowse.diff

File databrowse.diff, 1.3 KB (added by nick@…, 11 years ago)

patch to Databrowse docs describing how to restrict access to logged-in users

  • docs/databrowse.txt

    5959    4. Run the Django server and visit ``/databrowse/`` in your browser.
     61Requiring user login
     64If you wish, you can retrict access to Databrowse to logged-in users with
     65only a few extra lines of code.  Simply add the following import to your
     68    from django.contrib.auth.decorators import login_required
     70Then modify the URLconf so that the ``databrowse.site.root`` view is decorated
     71with ``login_required``::
     73    (r'^databrowse/(.*)', login_required(databrowse.site.root)),
     75If you haven't already added support for user logins to your URLconf, as
     76described in the `user authentication docs`_, then you will need to do so
     77now with the following mapping::
     79    (r'^accounts/login/$', 'django.contrib.auth.views.login'),
     81The final step is to create the login form required by
     82``django.contrib.auth.views.login``.  The `user authentication docs`_
     83provide full details and a sample template that can be used for this
    6186.. _template loader docs: ../templates_python/#loader-types
     87.. _user authentication docs: ../authentication/
Back to Top