<i id='EYQUc'><tr id='EYQUc'><dt id='EYQUc'><q id='EYQUc'><span id='EYQUc'><b id='EYQUc'><form id='EYQUc'><ins id='EYQUc'></ins><ul id='EYQUc'></ul><sub id='EYQUc'></sub></form><legend id='EYQUc'></legend><bdo id='EYQUc'><pre id='EYQUc'><center id='EYQUc'></center></pre></bdo></b><th id='EYQUc'></th></span></q></dt></tr></i><div id='EYQUc'><tfoot id='EYQUc'></tfoot><dl id='EYQUc'><fieldset id='EYQUc'></fieldset></dl></div>

    • <bdo id='EYQUc'></bdo><ul id='EYQUc'></ul>

  • <legend id='EYQUc'><style id='EYQUc'><dir id='EYQUc'><q id='EYQUc'></q></dir></style></legend>

      <small id='EYQUc'></small><noframes id='EYQUc'>

      1. <tfoot id='EYQUc'></tfoot>

        Django:内置密码重置视图

        Django: built-in password reset views(Django:内置密码重置视图)

            <bdo id='cNh8x'></bdo><ul id='cNh8x'></ul>
              <tbody id='cNh8x'></tbody>

            <tfoot id='cNh8x'></tfoot>

            <small id='cNh8x'></small><noframes id='cNh8x'>

              • <i id='cNh8x'><tr id='cNh8x'><dt id='cNh8x'><q id='cNh8x'><span id='cNh8x'><b id='cNh8x'><form id='cNh8x'><ins id='cNh8x'></ins><ul id='cNh8x'></ul><sub id='cNh8x'></sub></form><legend id='cNh8x'></legend><bdo id='cNh8x'><pre id='cNh8x'><center id='cNh8x'></center></pre></bdo></b><th id='cNh8x'></th></span></q></dt></tr></i><div id='cNh8x'><tfoot id='cNh8x'></tfoot><dl id='cNh8x'><fieldset id='cNh8x'></fieldset></dl></div>
                  <legend id='cNh8x'><style id='cNh8x'><dir id='cNh8x'><q id='cNh8x'></q></dir></style></legend>
                  本文介绍了Django:内置密码重置视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在关注文档,当我单击该页面以重新启动密码时收到 NoReverseMatch 错误.

                  I am following the documentation and I am getting a NoReverseMatch error when I click on the page to restart my password.

                  NoReverseMatch 在/resetpassword/未找到带有参数()"和关键字参数{}"的password_reset_done"的反向操作.尝试了 0 个模式:[]

                  NoReverseMatch at /resetpassword/ Reverse for 'password_reset_done' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

                  urls.py:

                  (r'^resetpassword/passwordsent/$', 'django.contrib.auth.views.password_reset_done'),
                  (r'^resetpassword/$', 'django.contrib.auth.views.password_reset', name="reset_password"),
                  (r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>,+)/$', 'django.contrib.auth.views.password_reset_confirm'),
                  (r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),
                  

                  这是在我的 base.html 模板中调用此 url 的代码:

                  Here is the code that calls this url in my base.html template:

                  <a href="{% url 'reset_password' %}">Reset Password</a>
                  

                  我已经为此工作了好几个小时.(我是初学者!)任何帮助将不胜感激,谢谢!

                  I have been working at this for hours. (I'm a beginner!) Any help would be much appreciated, thanks!

                  推荐答案

                  urls.py 中为 password_reset_done 的条目添加 url 名称:

                  Add the url name to the entry in your urls.py for password_reset_done:

                  (r'^resetpassword/passwordsent/$', 'django.contrib.auth.views.password_reset_done', name='password_reset_done'),
                  

                  在内部,password_reset 视图使用 reverse('password_reset_done') 来查找重置密码后将用户发送到哪里.reverse 可以采用函数名的字符串表示形式,但它需要匹配您的模式中使用的形式 - 在这种情况下,它无法匹配,因为您的模式中指定了完整路径但没有在反向调用中.您可以从模块中导入视图并在模式中仅使用它们的名称,或者在模式中使用前缀(如果您更喜欢 name 参数).

                  Internally, the password_reset view uses reverse('password_reset_done') to look up where to send the user after resetting the password. reverse can take a string representation of a function name, but it needs to match the form used in your patterns - in this case, it can't match because the full path is specified in your pattern but not in the reverse call. You could import the views from the module and use just their names in the pattern or use a prefix in your patterns if you'd prefer that over the name argument.

                  https://docs.djangoproject.com/en/dev/ref/urlresolvers/#django.core.urlresolvers.reverse 了解 reverse 的详细信息.

                  https://docs.djangoproject.com/en/dev/ref/urlresolvers/#django.core.urlresolvers.reverse for the details on reverse.

                  这篇关于Django:内置密码重置视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Adding config modes to Plotly.Py offline - modebar(将配置模式添加到 Plotly.Py 离线 - 模式栏)
                  Plotly: How to style a plotly figure so that it doesn#39;t display gaps for missing dates?(Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙?)
                  python save plotly plot to local file and insert into html(python将绘图保存到本地文件并插入到html中)
                  Plotly: What color cycle does plotly express follow?(情节:情节表达遵循什么颜色循环?)
                  How to save plotly express plot into a html or static image file?(如何将情节表达图保存到 html 或静态图像文件中?)
                  Plotly: How to make a line plot from a pandas dataframe with a long or wide format?(Plotly:如何使用长格式或宽格式的 pandas 数据框制作线图?)
                • <small id='sL7E8'></small><noframes id='sL7E8'>

                  <legend id='sL7E8'><style id='sL7E8'><dir id='sL7E8'><q id='sL7E8'></q></dir></style></legend>

                    <bdo id='sL7E8'></bdo><ul id='sL7E8'></ul>
                  • <tfoot id='sL7E8'></tfoot>
                          <i id='sL7E8'><tr id='sL7E8'><dt id='sL7E8'><q id='sL7E8'><span id='sL7E8'><b id='sL7E8'><form id='sL7E8'><ins id='sL7E8'></ins><ul id='sL7E8'></ul><sub id='sL7E8'></sub></form><legend id='sL7E8'></legend><bdo id='sL7E8'><pre id='sL7E8'><center id='sL7E8'></center></pre></bdo></b><th id='sL7E8'></th></span></q></dt></tr></i><div id='sL7E8'><tfoot id='sL7E8'></tfoot><dl id='sL7E8'><fieldset id='sL7E8'></fieldset></dl></div>
                              <tbody id='sL7E8'></tbody>