表单的写法参考https://www.runoob.com/django/django-form-component.html
    so,自定义account的login.html方法就是

    1. <head>
    2. <meta charset="UTF-8">
    3. <meta name="viewport" content="width=device-width, initial-scale=1.0">
    4. <title>Document</title>
    5. <style>
    6. * {
    7. margin: 0;
    8. padding: 0;
    9. }
    10. html {
    11. height: 100%;
    12. }
    13. body {
    14. height: 100%;
    15. }
    16. .container {
    17. height: 100%;
    18. background-image: linear-gradient(to right, #fbc2eb, #a6c1ee);
    19. }
    20. .login-wrapper {
    21. background-color: #fff;
    22. width: 358px;
    23. height: 588px;
    24. border-radius: 15px;
    25. padding: 0 50px;
    26. position: relative;
    27. left: 50%;
    28. top: 50%;
    29. transform: translate(-50%, -50%);
    30. }
    31. .header {
    32. font-size: 38px;
    33. font-weight: bold;
    34. text-align: center;
    35. line-height: 200px;
    36. }
    37. .input-item {
    38. display: block;
    39. width: 100%;
    40. margin-bottom: 20px;
    41. border: 0;
    42. padding: 10px;
    43. border-bottom: 1px solid rgb(128, 125, 125);
    44. font-size: 15px;
    45. outline: none;
    46. }
    47. .input-item:placeholder {
    48. text-transform: uppercase;
    49. }
    50. #id_username{
    51. text-align: center;
    52. }
    53. .btn {
    54. text-align: center;
    55. padding: 10px;
    56. width: 100%;
    57. margin-top: 40px;
    58. background-image: linear-gradient(to right, #a6c1ee, #fbc2eb);
    59. color: #fff;
    60. }
    61. .msg {
    62. text-align: center;
    63. line-height: 88px;
    64. }
    65. a {
    66. text-decoration-line: none;
    67. color: #abc1ee;
    68. }
    69. </style>
    70. </head>
    71. <body>
    72. <div class="container">
    73. <div class="login-wrapper">
    74. <div class="header">Login</div>
    75. <div class="form-wrapper">
    76. <!-- <input type="text" name="username" placeholder="username" class="input-item">-->
    77. <!-- <input type="password" name="password" placeholder="password" class="input-item">-->
    78. <form method="post" novalidate>
    79. {% csrf_token %}
    80. <!-- {{ form.as_p }}-->
    81. <div>
    82. <label for="id_{{ form.username.name }}">我的用户名: </label>
    83. {{ form.username }} <span>{{ form.username.errors.0 }}</span>
    84. </div>
    85. <label for="id_{{ form.password.name }}">我的密码 </label>
    86. {{ form.password }} <span>{{ form.password.errors.0 }}</span>
    87. <!-- <input id="id_username" type="text" name="my_username"><br>-->
    88. <!-- <label for="my_id_password">我的密码: </label>-->
    89. <!-- <input id="my_id_password" type="password" name="my_password">-->
    90. <button class="btn btn-success ml-2" type="submit">Login</button>
    91. </form>
    92. <!-- <div class="btn">Login</div>-->
    93. </div>
    94. <div class="msg">
    95. Don't have account?
    96. <a href="#">Sign up</a>
    97. </div>
    98. </div>
    99. </div>
    100. </body>