Built-in class-based generic views

Writing Web applications can be monotonous, because we repeat certain patterns again and again. Django tries to take away some of that monotony at the model and template layers, but Web developers also experience this boredom at the view level. Django’s generic views were developed to ease that pain. They take certain common idioms and patterns found in view development and abstract them so that you can quickly write common views of data without having to write too much code. We can recognize c

Authentication using REMOTE_USER

This document describes how to make use of external authentication sources (where the Web server sets the REMOTE_USER environment variable) in your Django applications. This type of authentication solution is typically seen on intranet sites, with single sign-on solutions such as IIS and Integrated Windows Authentication or Apache and mod_authnz_ldap, CAS, Cosign, WebAuth, mod_auth_sspi, etc. When the Web server takes care of authentication it typically sets the REMOTE_USER environment variable

Authenticating against Django’s user database from Apache

Since keeping multiple authentication databases in sync is a common problem when dealing with Apache, you can configure Apache to authenticate against Django’s authentication system directly. This requires Apache version >= 2.2 and mod_wsgi >= 2.0. For example, you could: Serve static/media files directly from Apache only to authenticated users. Authenticate access to a Subversion repository against Django users with a certain permission. Allow certain users to connect to a WebDAV share c

auth.views.redirect_to_login()

redirect_to_login(next, login_url=None, redirect_field_name='next') Redirects to the login page, and then back to another URL after a successful login. Required arguments: next: The URL to redirect to after a successful login. Optional arguments: login_url: The URL of the login page to redirect to. Defaults to settings.LOGIN_URL if not supplied. redirect_field_name: The name of a GET field containing the URL to redirect to after log out. Overrides next if the given GET parameter is pass

auth.views.password_reset_done()

password_reset_done(request, template_name='registration/password_reset_done.html', current_app=None, extra_context=None) The page shown after a user has been emailed a link to reset their password. This view is called by default if the password_reset() view doesn’t have an explicit post_reset_redirect URL set. URL name: password_reset_done Note If the email address provided does not exist in the system, the user is inactive, or has an unusable password, the user will still be redirected to

auth.views.password_reset_confirm()

password_reset_confirm(request, uidb64=None, token=None, template_name='registration/password_reset_confirm.html', token_generator=default_token_generator, set_password_form=SetPasswordForm, post_reset_redirect=None, current_app=None, extra_context=None) Presents a form for entering a new password. URL name: password_reset_confirm Optional arguments: uidb64: The user’s id encoded in base 64. Defaults to None. token: Token to check that the password is valid. Defaults to None. template_nam

auth.views.password_reset_complete()

password_reset_complete(request, template_name='registration/password_reset_complete.html', current_app=None, extra_context=None) Presents a view which informs the user that the password has been successfully changed. URL name: password_reset_complete Optional arguments: template_name: The full name of a template to display the view. Defaults to registration/password_reset_complete.html. current_app: A hint indicating which application contains the current view. See the namespaced URL reso

auth.views.password_reset()

password_reset(request, template_name='registration/password_reset_form.html', email_template_name='registration/password_reset_email.html', subject_template_name='registration/password_reset_subject.txt', password_reset_form=PasswordResetForm, token_generator=default_token_generator, post_reset_redirect=None, from_email=None, current_app=None, extra_context=None, html_email_template_name=None, extra_email_context=None) Allows a user to reset their password by generating a one-time use link

auth.views.password_change_done()

password_change_done(request, template_name='registration/password_change_done.html', current_app=None, extra_context=None) The page shown after a user has changed their password. URL name: password_change_done Optional arguments: template_name: The full name of a template to use. Defaults to registration/password_change_done.html if not supplied. current_app: A hint indicating which application contains the current view. See the namespaced URL resolution strategy for more information. ex

auth.views.password_change()

password_change(request, template_name='registration/password_change_form.html', post_change_redirect=None, password_change_form=PasswordChangeForm, current_app=None, extra_context=None) Allows a user to change their password. URL name: password_change Optional arguments: template_name: The full name of a template to use for displaying the password change form. Defaults to registration/password_change_form.html if not supplied. post_change_redirect: The URL to redirect to after a successfu