Python Django Htmlİ;“nput字段”&燃气轮机;性格

Python Django Htmlİ;“nput字段”&燃气轮机;性格,python,html,css,django,Python,Html,Css,Django,我正试图按照django的要求来设计我的登录页面表单。我在输入字段的末尾有一个额外的>”字符 出现图像错误。请参见下图 您可能需要注意输入字段的右上角。您知道“>是从哪里来的吗?谢谢你的时间 {%csrf\u令牌%} 显示 这是完整的代码 {% load static %} <!DOCTYPE html> <!-- Created By CodingNepal --> <html lang="en" dir="ltr"&g

我正试图按照django的要求来设计我的登录页面表单。我在输入字段的末尾有一个额外的>”字符

出现图像错误。请参见下图

您可能需要注意输入字段的右上角。您知道“>是从哪里来的吗?谢谢你的时间

{%csrf\u令牌%}
显示
这是完整的代码

{% load static %}
<!DOCTYPE html>
<!-- Created By CodingNepal -->
<html lang="en" dir="ltr">
    <head>
        <meta charset="utf-8">
        <!-- Somehow I got an error, so I comment the title, just uncomment to show -->
        <!-- <title>Transparent Login Form UI</title> -->
        <link href="{% static 'css/login.css' %}" rel="stylesheet" />
        <script src="https://kit.fontawesome.com/a076d05399.js"></script>
    </head>
    <body>
        <div class="bg-img">
            <div class="content">
            <header>Welcome to Norga</header>
            <form method="POST"> {% csrf_token%}
                <div class="field">
                    <span class="fa fa-user"></span>
                    <input type="text" required placeholder="Email Adress" for="{{form.username}}">
                    <!-- {{form.username}} -->
                </div>
                <div class="field space">
                    <span class="fa fa-lock"></span>
                    <input type="password" class="pass-key" required placeholder="Password" for="{{form.password}}">
                    <!-- {{form.password}} -->
                    <span class="show">SHOW</span>
                </div>
                <div class="pass">
                    <a href="#">Forgot Password?</a>
                </div>
                <div class="field">
                    <input type="submit" value="LOGIN">
                </div>
            </form>
            <div class="login">
            Or login with</div>
            <div class="links">
                <div class="facebook">
                    <i class="fab fa-facebook-f"><span>Facebook</span></i>
                </div>
                <div class="instagram">
                    <i class="fab fa-instagram"><span>Instagram</span></i>
                </div>
            </div>
            <div class="signup">
                Don't have account?
                <a href="{% url 'account_createview' %}">Signup Now</a>
            </div>
            <br>
            <div class="signup">
                Email verification
                <a href="{% url 'resend_email_verification' %}">Send Again</a>
            </div>
        </div>
    </div>
    <script>
    const pass_field = document.querySelector('.pass-key');
    const showBtn = document.querySelector('.show');
    showBtn.addEventListener('click', function(){
    if(pass_field.type === "password"){
    pass_field.type = "text";
    showBtn.textContent = "HIDE";
    showBtn.style.color = "#3498db";
    }else{
    pass_field.type = "password";
    showBtn.textContent = "SHOW";
    showBtn.style.color = "#222";
    }
    });
    </script>
</body>
</html>
{%load static%}
欢迎来到诺加
{%csrf_令牌%}
显示
或使用登录
脸谱网
一款图片分享应用
你没有帐户吗?

电子邮件验证 const pass_field=document.querySelector('.pass key'); const showBtn=document.querySelector('.show'); showBtn.addEventListener('click',function(){ if(pass_field.type==“password”){ pass_field.type=“text”; showBtn.textContent=“隐藏”; showBtn.style.color=“#3498db”; }否则{ pass_field.type=“password”; showBtn.textContent=“SHOW”; showBtn.style.color=“#222”; } });
我已经解决了重新编码登录视图的问题。我使用的是django auth_views.LoginView,但是它不适合我的html规模。因此,我在forms.py文件中创建了一个新表单,并根据下面的url更改了我的url

有一个解决方案的形式和保管的loginview和有我的新形式的html文件在下面

<form method="post">
{% csrf_token%}
            <div class="form-group">
                {{ form.non_field_errors }}
                {{ form.username.errors }}
                {{ form.password.errors }}
            </div>
            <div class="field">
                <span class="fa fa-user"></span>
                {{ form.username }}
            </div>
            <div class="field space">
                <span class="fa fa-lock"></span>
                {{ form.password }}
                <span class="show">SHOW</span>
            </div>
            <div class="pass">
                <a href="#">Forgot Password?</a>
            </div>
            <div class="field">
                <input type="submit" value="LOGIN">
            </div>
        </form>

{%csrf_令牌%}
{{form.non_field_errors}}
{{form.username.errors}
{{form.password.errors}
{{form.username}
{{form.password}}
显示

这个问题与Python到底有什么关系?能否显示加载的html页面这部分的源代码。
{{form.}
将呈现字段的整个输入标记,您需要用表单字段的输出替换输入标记,或者使用自定义html中字段的正确属性。我为我的模板添加了完整的代码。伊恩;我不确定我的代码哪里错了。您能更详细地描述一下吗?您在输入中使用的“for”必须用于其他标记,如label:First name: