D
D
Daniel2019-12-29 17:24:14
css
Daniel, 2019-12-29 17:24:14

How to add beauty to standard django forms?

Hello everyone, there is a class form.py

class AuthUserForm(AuthenticationForm, forms.ModelForm):
    class Meta:
        model = User
        fields = ('username','password')
    def __init__(self,*args,**kwargs):
        super().__init__(*args,**kwargs)
        for field in self.fields:
            self.fields[field].widget.attrs['class'] = 'form-control'

It is necessary to add a beautiful form to it, but I can not find the classes that are used through f12.
Here is the html code
<body>
<div class="col-4">
<form id="add_form" method="post">
    {% csrf_token %}
    {{form}}
    <button form="add_form" type="submit" class="login-button">>Войти</button>
</form>
</div>
</body>

Perhaps I put the question in the wrong way, and therefore it is not possible to dig up information on the Internet, if you poke into the solution, I will be very grateful. Happy new year friends.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question