Ticket #16610: django-docs-topic-auth-templates-context.patch
File django-docs-topic-auth-templates-context.patch, 5.7 KB (added by , 13 years ago) |
---|
-
docs/topics/auth.txt
954 954 955 955 * ``title``: The string "Logged out", localized. 956 956 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 957 969 .. function:: logout_then_login(request[, login_url]) 958 970 959 971 Logs a user out, then redirects to the login page. … … 976 988 * ``post_change_redirect``: The URL to redirect to after a successful 977 989 password change. 978 990 979 *.. versionadded:: 1.2991 .. versionadded:: 1.2 980 992 981 993 * ``password_change_form``: A custom "change password" form which must 982 994 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`. 984 997 985 986 998 **Template context:** 987 999 988 * ``form``: The password change form .1000 * ``form``: The password change form (see ``password_change_form`` above). 989 1001 990 1002 .. function:: password_change_done(request[, template_name]) 991 1003 … … 1006 1018 .. versionchanged:: 1.3 1007 1019 The ``from_email`` argument was added. 1008 1020 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 1009 1027 **Optional arguments:** 1010 1028 1011 1029 * ``template_name``: The full name of a template to use for … … 1037 1055 1038 1056 **Template context:** 1039 1057 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. 1041 1059 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:** 1047 1061 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 1048 1095 .. function:: password_reset_done(request[, template_name]) 1049 1096 1050 1097 The page shown after a user has been emailed a link to reset their … … 1065 1112 1066 1113 * ``uidb36``: The user's id encoded in base 36. This will default to 1067 1114 ``None``. 1115 1068 1116 * ``token``: Token to check that the password is valid. This will default to ``None``. 1117 1069 1118 * ``template_name``: The full name of a template to display the confirm 1070 1119 password view. Default value is :file:`registration/password_reset_confirm.html`. 1120 1071 1121 * ``token_generator``: Instance of the class to check the password. This 1072 1122 will default to ``default_token_generator``, it's an instance of 1073 1123 ``django.contrib.auth.tokens.PasswordResetTokenGenerator``. 1124 1074 1125 * ``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 1076 1128 * ``post_reset_redirect``: URL to redirect after the password reset 1077 1129 done. This will default to ``None``. 1078 1130 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 1079 1138 .. function:: password_reset_complete(request[,template_name]) 1080 1139 1081 1140 Presents a view which informs the user that the password has been