表单的写法参考https://www.runoob.com/django/django-form-component.html
so,自定义account的login.html方法就是
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
html {
height: 100%;
}
body {
height: 100%;
}
.container {
height: 100%;
background-image: linear-gradient(to right, #fbc2eb, #a6c1ee);
}
.login-wrapper {
background-color: #fff;
width: 358px;
height: 588px;
border-radius: 15px;
padding: 0 50px;
position: relative;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.header {
font-size: 38px;
font-weight: bold;
text-align: center;
line-height: 200px;
}
.input-item {
display: block;
width: 100%;
margin-bottom: 20px;
border: 0;
padding: 10px;
border-bottom: 1px solid rgb(128, 125, 125);
font-size: 15px;
outline: none;
}
.input-item:placeholder {
text-transform: uppercase;
}
#id_username{
text-align: center;
}
.btn {
text-align: center;
padding: 10px;
width: 100%;
margin-top: 40px;
background-image: linear-gradient(to right, #a6c1ee, #fbc2eb);
color: #fff;
}
.msg {
text-align: center;
line-height: 88px;
}
a {
text-decoration-line: none;
color: #abc1ee;
}
</style>
</head>
<body>
<div class="container">
<div class="login-wrapper">
<div class="header">Login</div>
<div class="form-wrapper">
<!-- <input type="text" name="username" placeholder="username" class="input-item">-->
<!-- <input type="password" name="password" placeholder="password" class="input-item">-->
<form method="post" novalidate>
{% csrf_token %}
<!-- {{ form.as_p }}-->
<div>
<label for="id_{{ form.username.name }}">我的用户名: </label>
{{ form.username }} <span>{{ form.username.errors.0 }}</span>
</div>
<label for="id_{{ form.password.name }}">我的密码 : </label>
{{ form.password }} <span>{{ form.password.errors.0 }}</span>
<!-- <input id="id_username" type="text" name="my_username"><br>-->
<!-- <label for="my_id_password">我的密码: </label>-->
<!-- <input id="my_id_password" type="password" name="my_password">-->
<button class="btn btn-success ml-2" type="submit">Login</button>
</form>
<!-- <div class="btn">Login</div>-->
</div>
<div class="msg">
Don't have account?
<a href="#">Sign up</a>
</div>
</div>
</div>
</body>