K
K
Kwad2020-05-27 14:22:38
Django
Kwad, 2020-05-27 14:22:38

How to style or bind a form to django allauth?

I'm trying to make a beautiful authorization form, but I can't figure out how to bind my inputs to allaush. How to do it right? I used the login password - password1 as they wrote on the stack, it didn't help, I rummaged through the allauth git - I didn't find anything useful. Here are the screenshots:
5ece4d55046b9904933175.png

spoiler
<div class="card-body">
                  <h4 class="text-center"> Авторизация</h4> <br>
                  <form class="pt-3" method="post">
                  <div class="form-group">

                    {% csrf_token %}
                    {{ form.login.errors }}
                    {{ form.password.errors }}
                    <div class="md-form mb-5">
                      <input type='text' placeholder='Номер' id='id_login' name='login1' class='form-control' />
                      <label for="login1" class="">Пароль</label>
                    </div>
                    <div class="md-form mb-5">
                      <input type='password' placeholder='Пароль' id='id_password1' name='password1' class='form-control' />
                      <label for="password1" class="">Пароль</label>
                    </div>

                    {% if redirect_field_value %}
                    <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
                    {% endif %}
                  </div>

                  <div class="my-3">
                    <button class="btn btn-secondary btn-lg btn-block" type="submit">Войти</button>
                  </div>

                  <div class="text-center mt-4 font-weight-light">
                    Нет аккаунта? <a href="/accounts/signup/" class="text-primary">Создать</a>
                  </div>

                </form>
                </div>
              </div>


The error is that it does not accept the entered data.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Melnikov, 2020-05-27
@Kwad

There are different identifiers.

<form class="form-login login" method="POST" action="{% url 'login' %}">
                    {% csrf_token %}
                    <div class="form__input">
                        <div class="form__input_gr">
                            <input type="text" name="username" id="username" placeholder="Login" required>
                            <i class="fas fa-user"></i>
                        </div>
                    </div>
                    <div class="form__input" >
                        <div class="form__input_gr">
                            <input type="password" name="password" id="password" placeholder="Password" required>
                            <i class="fas fa-lock"></i>
                        </div>
                    </div>
                    <div class="form__input">
                        <input type="submit" value="Войти">
                    </div>
                </form>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question