Ticket #10272: 10272-document-signatures-parameters-r10680.diff

File 10272-document-signatures-parameters-r10680.diff, 6.7 KB (added by Idan Gazit, 10 years ago)
  • docs/topics/auth.txt

     
    697697
    698698    (r'^accounts/login/$', 'django.contrib.auth.views.login'),
    699699
    700 .. function:: views.login()
     700.. function:: views.login(request, [template_name, redirect_field_name])
    701701
    702702    Here's what ``django.contrib.auth.views.login`` does:
    703703
     
    712712          redisplays the login form.
    713713
    714714    It's your responsibility to provide the login form in a template called
    715     ``registration/login.html`` by default. This template gets passed three
     715    ``registration/login.html`` by default. This template gets passed four
    716716    template context variables:
    717717
    718718        * ``form``: A :class:`~django.forms.Form` object representing the login
     
    721721
    722722        * ``next``: The URL to redirect to after successful login. This may
    723723          contain a query string, too.
     724       
     725        * ``site``: The current :class:`~django.contrib.sites.models.Site`,
     726          according to the :setting:`SITE_ID` setting. If you're using the
     727          Django development version and you don't have the site framework
     728          installed, this will be set to an instance of
     729          :class:`~django.contrib.sites.models.RequestSite`, which derives the
     730          site name and domain from the current :class:`~django.http.HttpRequest`.
     731       
     732        * ``site_name``: An alias for ``site.name``. If you're using the
     733          Django development version and you don't have the site framework
     734          installed, this will be set to the value of
     735          :attr:`request.META['SERVER_NAME'] <django.http.HttpRequest.META>`.
     736          For more on sites, see :ref:`ref-contrib-sites`.
    724737
    725         * ``site_name``: The name of the current
    726           :class:`~django.contrib.sites.models.Site`, according to the
    727           :setting:`SITE_ID` setting. If you're using the Django development
    728           version and you don't have the site framework installed, this will be
    729           set to the value of :attr:`request.META['SERVER_NAME']
    730           <django.http.HttpRequest.META>`. For more on sites, see
    731           :ref:`ref-contrib-sites`.
    732 
    733738    If you'd prefer not to call the template :file:`registration/login.html`,
    734739    you can pass the ``template_name`` parameter via the extra arguments to
    735740    the view in your URLconf. For example, this URLconf line would use
    736741    :file:`myapp/login.html` instead::
    737742
    738743        (r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'myapp/login.html'}),
    739 
     744       
     745    You can also specify the name of the ``GET`` field which contains the URL
     746    to redirect to after login by passing ``redirect_field_name`` to the view.
     747    By default, the field is called ``next``.
     748       
    740749    Here's a sample :file:`registration/login.html` template you can use as a
    741750    starting point. It assumes you have a :file:`base.html` template that
    742751    defines a ``content`` block:
     
    818827          displaying the password change form. This will default to
    819828          :file:`registration/password_change_form.html` if not supplied.
    820829
    821         * ``post_change_redirect``: The URL to redirect to after successful
     830        * ``post_change_redirect``: The URL to redirect to after a successful
    822831          password change.
    823832
    824833    **Template context:**
     
    835844          default to :file:`registration/password_change_done.html` if not
    836845          supplied.
    837846
    838 .. function:: views.password_reset
     847.. function:: views.password_reset(request[, is_admin_site, template_name, email_template_name, password_reset_form, token_generator, post_reset_redirect])
    839848
    840849    Allows a user to reset their password, and sends them the new password
    841850    in an e-mail.
     
    849858        * ``email_template_name``: The full name of a template to use for
    850859          generating the e-mail with the new password. This will default to
    851860          :file:`registration/password_reset_email.html` if not supplied.
    852 
     861       
     862        * ``password_reset_form``: Form that will be used to set the password.
     863          Defaults to ``SetPasswordForm``.
     864       
     865        * ``token_generator``: Instance of the class to check the password. This
     866          will default to ``default_token_generator``, it's an instance of
     867          ``django.contrib.auth.tokens.PasswordResetTokenGenerator``.
     868         
     869        * ``post_reset_redirect``: The URL to redirect to after a successful
     870          password change.
     871         
    853872    **Template context:**
    854873
    855874        * ``form``: The form for resetting the user's password.
    856875
    857 .. function:: views.password_reset_done
     876.. function:: views.password_reset_done(request[, template_name])
    858877
    859878    The page shown after a user has reset their password.
    860879
     
    864883          default to :file:`registration/password_reset_done.html` if not
    865884          supplied.
    866885
    867 .. function:: views.redirect_to_login
     886.. function:: views.redirect_to_login(next[, login_url, redirect_field_name])
    868887
    869888    Redirects to the login page, and then back to another URL after a
    870889    successful login.
     
    877896
    878897        * ``login_url``: The URL of the login page to redirect to. This will
    879898          default to :setting:`settings.LOGIN_URL <LOGIN_URL>` if not supplied.
     899         
     900        * ``redirect_field_name``: The name of a ``GET`` field containing the
     901          URL to redirect to after log out. Overrides ``next`` if the given
     902          ``GET`` parameter is passed.
     903         
     904.. function:: password_reset_confirm(request[, uidb36, token, template_name, token_generator, set_password_form, post_reset_redirect])
    880905
    881 .. function:: password_reset_confirm(request[,uidb36, token, template_name, token_generator, set_password_form, post_reset_redirect])
    882 
    883906    Presents a form for entering a new password.
    884907
    885908    **Optional arguments:**
     
    892915        * ``token_generator``: Instance of the class to check the password. This
    893916          will default to ``default_token_generator``, it's an instance of
    894917          ``django.contrib.auth.tokens.PasswordResetTokenGenerator``.
    895         * ``set_password_form``: Form that will use to set the password. This will
    896           default to ``SetPasswordForm``.
     918        * ``set_password_form``: Form that will be used to set the password.
     919          This will default to ``SetPasswordForm``.
    897920        * ``post_reset_redirect``: URL to redirect after the password reset
    898921          done. This will default to ``None``.
    899922
    900923.. function:: password_reset_complete(request[,template_name])
    901924
    902    Presents a view that informs that the password has been changed very well.
     925   Presents a view which informs the user that the password has been
     926   successfully changed.
    903927
    904928   **Optional arguments:**
    905929
Back to Top