/ users / login / __init __()处的TypeError带有1个位置参数,但给出了2个

Ayushhirmani

我目前正在研究“ Python崩溃课程”一书中的教程。

本教程介绍如何使用Django创建“学习日志” Webapp。该应用程序的想法是允许用户:1.创建他们已了解的“主题” 2.将“条目”添加到这些主题,描述他们已针对这些主题学习的详细信息

我目前在登录页面上停留并在运行时收到错误消息

http:// localhost:8000 / users / login /

urls.py

    from django.conf.urls import url
    # Importing the default login view provided by Django
    from django.contrib.auth.views import LoginView
    from .import views 
    app_name = 'users'
    urlpatterns =[
    # Login page
    url(r'^login/$', LoginView , {'template_name':'users/login.html'},name = 'login'), 
                 ]

login.html

    {% extends "learning_logs/base.html" %}

    {% block content %}
    {% if form.errors %}
    <p> Your username and password didn't match.Please try again. </p>
    {% endif %}

    <form method="post" action="{%url 'users:login' %}">
    {%csrf_token %}
    {{form.as_p}}
    <button name="submit">log in</button>
    <input type="hidden" name="next" value="{%url 'learning_logs:index' %}"/>
    </form>


   {% endblock content %}

base.html

    <p>
      <a href="{% url 'learning_logs:index' %}">Learning Log</a> -
      <a href="{% url 'learning_logs:topics'%}">Topics</a> -
      {% if user.is_authenticated %}
        Hello,{{user.username}}.
     {% else %}
       <a href="{% url 'users:login' %}">log in</a>
     {% endif %}
   </p>

   {% block content %}{% endblock content %}
威廉·范昂塞姆

LoginView是一个基于类的视图,可以使用.as_view(…)[Django的DOC]在使用它urls.py您可以在中传递template_nameas参数.as_view(…)

url(r'^login/$', LoginView.as_view(template_name='users/login.html'), name='login'),

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

TypeError:init_animals()接受1个位置参数,但给出了2个

来自分类Dev

Money和TypeError:__init __()接受1到2个位置参数,但给出了3个

来自分类Dev

TypeError:init_animals()接受1个位置参数,但给出了2个

来自分类Dev

Money和TypeError:__init __()接受1到2个位置参数,但给出了3个

来自分类Dev

TypeError:login()接受1个位置参数,但给出了2个

来自分类Dev

/ users / sigup create_user()处的TypeError接受2到4个位置参数,但给出了5个

来自分类Dev

TypeError at : / __init__() 需要 1 个位置参数,但给出了 2 个

来自分类Dev

TypeError:__init __()接受1个位置参数,但给出了3个

来自分类Dev

多重继承,TypeError:__init __()接受2个位置参数,但给出了3个

来自分类Dev

TypeError:__init __()接受1个位置参数,但给出了2个(使用Pytesseract的Python多处理)

来自分类Dev

Django客户端获取:TypeError:__init __()接受1个位置参数,但给出了2个

来自分类Dev

python super :TypeError: __init__() 需要 2 个位置参数,但给出了 3 个

来自分类Dev

TypeError: __init__() 需要 2 个位置参数,但 Python 3 给出了 3 个?

来自分类Dev

陷入类型错误:__init__() 需要 1 个位置参数,但给出了 2 个

来自分类Dev

无法继承正确的父类,init 需要 1 个位置参数,但给出了 2 个

来自分类Dev

错误:类型错误:__init__() 需要 1 个位置参数,但给出了 2 个

来自分类Dev

错误:__ init __()接受1个位置参数,但给出了7个

来自分类Dev

__init __()接受1个位置参数,但给出了8个

来自分类Dev

__init __()接受1到3个位置参数,但给出了4个

来自分类Dev

Python:__init __()接受2个位置参数,但给出了3个

来自分类Dev

这里抛出了TypeError异常:init()接受2个位置参数,但使用Selenium和Python的显式等待给出3个

来自分类Dev

类型错误:__init__() 需要 4 个位置参数,但给出了 7 个

来自分类Dev

TypeError:__init __()接受1个位置参数,但给了2个discord.py

来自分类Dev

__init __()接受2个位置参数,但是使用present_of_element_located()给出了3个试图等待元素的参数

来自分类Dev

__init __()接受1个位置参数,但给了2个登录页面

来自分类Dev

/ __init __()处的TypeError恰好接受1个参数(给定2个)

来自分类Dev

__init __()接受3个位置参数,但运行时给出4个

来自分类Dev

KeyError at /users/login 'isLoggedIn'

来自分类Dev

TypeError:quit()接受1个位置参数,但给出了2个(键盘绑定)

Related 相关文章

  1. 1

    TypeError:init_animals()接受1个位置参数,但给出了2个

  2. 2

    Money和TypeError:__init __()接受1到2个位置参数,但给出了3个

  3. 3

    TypeError:init_animals()接受1个位置参数,但给出了2个

  4. 4

    Money和TypeError:__init __()接受1到2个位置参数,但给出了3个

  5. 5

    TypeError:login()接受1个位置参数,但给出了2个

  6. 6

    / users / sigup create_user()处的TypeError接受2到4个位置参数,但给出了5个

  7. 7

    TypeError at : / __init__() 需要 1 个位置参数,但给出了 2 个

  8. 8

    TypeError:__init __()接受1个位置参数,但给出了3个

  9. 9

    多重继承,TypeError:__init __()接受2个位置参数,但给出了3个

  10. 10

    TypeError:__init __()接受1个位置参数,但给出了2个(使用Pytesseract的Python多处理)

  11. 11

    Django客户端获取:TypeError:__init __()接受1个位置参数,但给出了2个

  12. 12

    python super :TypeError: __init__() 需要 2 个位置参数,但给出了 3 个

  13. 13

    TypeError: __init__() 需要 2 个位置参数,但 Python 3 给出了 3 个?

  14. 14

    陷入类型错误:__init__() 需要 1 个位置参数,但给出了 2 个

  15. 15

    无法继承正确的父类,init 需要 1 个位置参数,但给出了 2 个

  16. 16

    错误:类型错误:__init__() 需要 1 个位置参数,但给出了 2 个

  17. 17

    错误:__ init __()接受1个位置参数,但给出了7个

  18. 18

    __init __()接受1个位置参数,但给出了8个

  19. 19

    __init __()接受1到3个位置参数,但给出了4个

  20. 20

    Python:__init __()接受2个位置参数,但给出了3个

  21. 21

    这里抛出了TypeError异常:init()接受2个位置参数,但使用Selenium和Python的显式等待给出3个

  22. 22

    类型错误:__init__() 需要 4 个位置参数,但给出了 7 个

  23. 23

    TypeError:__init __()接受1个位置参数,但给了2个discord.py

  24. 24

    __init __()接受2个位置参数,但是使用present_of_element_located()给出了3个试图等待元素的参数

  25. 25

    __init __()接受1个位置参数,但给了2个登录页面

  26. 26

    / __init __()处的TypeError恰好接受1个参数(给定2个)

  27. 27

    __init __()接受3个位置参数,但运行时给出4个

  28. 28

    KeyError at /users/login 'isLoggedIn'

  29. 29

    TypeError:quit()接受1个位置参数,但给出了2个(键盘绑定)

热门标签

归档