Ticket #16610: django-docs-topic-auth-templates-context.patch

File django-docs-topic-auth-templates-context.patch, 5.7 KB (added by Tomáš Ehrlich, 13 years ago)
  • docs/topics/auth.txt

     
    954954
    955955        * ``title``: The string "Logged out", localized.
    956956
     957        * ``site``: The current :class:`~django.contrib.sites.models.Site`,
     958          according to the :setting:`SITE_ID` setting. If you don't have the
     959          site framework installed, this will be set to an instance of
     960          :class:`~django.contrib.sites.models.RequestSite`, which derives the
     961          site name and domain from the current
     962          :class:`~django.http.HttpRequest`.
     963
     964        * ``site_name``: An alias for ``site.name``. If you don't have the site
     965          framework installed, this will be set to the value of
     966          :attr:`request.META['SERVER_NAME'] <django.http.HttpRequest.META>`.
     967          For more on sites, see :doc:`/ref/contrib/sites`.
     968
    957969.. function:: logout_then_login(request[, login_url])
    958970
    959971    Logs a user out, then redirects to the login page.
     
    976988        * ``post_change_redirect``: The URL to redirect to after a successful
    977989          password change.
    978990
    979         * .. versionadded:: 1.2
     991          .. versionadded:: 1.2
    980992
    981           ``password_change_form``: A custom "change password" form which must
     993        * ``password_change_form``: A custom "change password" form which must
    982994          accept a ``user`` keyword argument. The form is responsible for
    983           actually changing the user's password.
     995          actually changing the user's password. Defaults to
     996          :class:`~django.contrib.auth.forms.PasswordChangeForm`.
    984997
    985 
    986998    **Template context:**
    987999
    988         * ``form``: The password change form.
     1000        * ``form``: The password change form (see ``password_change_form`` above).
    9891001
    9901002.. function:: password_change_done(request[, template_name])
    9911003
     
    10061018    .. versionchanged:: 1.3
    10071019        The ``from_email`` argument was added.
    10081020
     1021    .. versionchanged:: 1.4
     1022        Users flagged with an unusable password (see
     1023        :meth:`~django.contrib.auth.models.User.set_unusable_password()`
     1024        will not be able to request a password reset to prevent misuse
     1025        when using an external authentication source like LDAP.
     1026
    10091027    **Optional arguments:**
    10101028
    10111029        * ``template_name``: The full name of a template to use for
     
    10371055
    10381056    **Template context:**
    10391057
    1040         * ``form``: The form for resetting the user's password.
     1058        * ``form``: The form (see ``password_reset_form`` above) for resetting the user's password.
    10411059
    1042         .. versionchanged:: 1.4
    1043             Users flagged with an unusable password (see
    1044             :meth:`~django.contrib.auth.models.User.set_unusable_password()`
    1045             will not be able to request a password reset to prevent misuse
    1046             when using an external authentication source like LDAP.
     1060    **Email templates context:**
    10471061
     1062        * ``email``: An alias for ``user.email``
     1063
     1064        * ``user``: The current :class:`~django.contrib.auth.models.User`,
     1065          according to the ``email`` form field. Only active users are selected
     1066          (``is_active == True``).
     1067
     1068        * ``site_name``: An alias for ``site.name``. If you don't have the site
     1069          framework installed, this will be set to the value of
     1070          :attr:`request.META['SERVER_NAME'] <django.http.HttpRequest.META>`.
     1071          For more on sites, see :doc:`/ref/contrib/sites`.
     1072
     1073        * ``domain``: An alias for ``site.domain``. If you don't have the site
     1074          framework installed, this will be set to the value of
     1075          ``request.get_host()``.
     1076
     1077        * ``protocol``: http or https
     1078
     1079        * ``uid``: The user's id encoded in base 36.
     1080       
     1081        * ``token``: Token to check that the password is valid.
     1082
     1083    Sample ``registration/password_reset_email.html`` (email body template):
     1084
     1085    .. code-block:: html+django
     1086
     1087        {% load url from future %}
     1088        Someone asked for password reset for email {{ email }}. Follow the link below:
     1089        {{ protocol}}://{{ site_name }}{% url 'auth_password_reset_confirm' uidb36=uid token=token %}
     1090
     1091    The same template context is used for subject template. Subject must be
     1092    single line plain text string.
     1093
     1094
    10481095.. function:: password_reset_done(request[, template_name])
    10491096
    10501097    The page shown after a user has been emailed a link to reset their
     
    10651112
    10661113        * ``uidb36``: The user's id encoded in base 36. This will default to
    10671114          ``None``.
     1115
    10681116        * ``token``: Token to check that the password is valid. This will default to ``None``.
     1117
    10691118        * ``template_name``: The full name of a template to display the confirm
    10701119          password view. Default value is :file:`registration/password_reset_confirm.html`.
     1120
    10711121        * ``token_generator``: Instance of the class to check the password. This
    10721122          will default to ``default_token_generator``, it's an instance of
    10731123          ``django.contrib.auth.tokens.PasswordResetTokenGenerator``.
     1124
    10741125        * ``set_password_form``: Form that will be used to set the password.
    1075           This will default to ``SetPasswordForm``.
     1126          Defaults to :class:`~django.contrib.auth.forms.SetPasswordForm`
     1127
    10761128        * ``post_reset_redirect``: URL to redirect after the password reset
    10771129          done. This will default to ``None``.
    10781130
     1131    **Template context:**
     1132
     1133        * ``form``: The form (see ``set_password_form`` above) for setting the new user's password.
     1134
     1135        * ``validlink``: Boolean, True if the link (combination of uidb36 and
     1136          token) is valid or unused yet.
     1137
    10791138.. function:: password_reset_complete(request[,template_name])
    10801139
    10811140   Presents a view which informs the user that the password has been
Back to Top