Hey! You should check the documentation https://docs.djangoproject.com/en/2.0/topics/forms/#working-with-form-templates for the Forms that django uses. Each form has it's fields as attributes that generate the input tag that will house the input you receive.
You could, for example, create a customize the User login form, and use the attrs attributes for the widget class of each field https://docs.djangoproject.com/en/2.0/ref/forms/widgets/ There are also some handy django apps that can make your life easier, for example this one https://github.com/jazzband/django-widget-tweaks/blob/master/README.rst that enables you to set the class attribute off the template tag. I recommend you to try first to do it yourself, as a learning experience and then use the django-widget-tweaks when you understand what goes behind setting custom widget attrs. Hope it helps! On Wed, Jun 6, 2018, 17:59 G.R. Nobles <[email protected]> wrote: > Below are two forms, the login form (top) and a bootstrap form (bottom), > I'm trying to apply bootstrap to the login page, how can I integrate > bootstrap onto the login objects, e.g. {{ form.username }} is the entire > textbox, so I'm at a loss being a beginner with Django (my first week). > > {% if form.errors %} > <p>Your username and password didn't match. Please try again.</p> > {% endif %} > > {% if next %} > {% if user.is_authenticated %} > <p>Your account doesn't have access to this page. To proceed, > please login with an account that has access.</p> > {% else %} > <p>Please login to see this page.</p> > {% endif %} > {% endif %} > > <form method="post" action="{% url 'login' %}"> > {% csrf_token %} > <div> > <td>{{ form.username.label_tag }}</td> > <td>{{ form.username }}</td> > </div> > <div> > <td>{{ form.password.label_tag }}</td> > <td>{{ form.password }}</td> > </div> > </form> > <form method="post" action="{% url 'login' %}"> > <div> > <input type="submit" value="login" /> > <input type="hidden" name="next" value="{{ next }}" /> > </div> > <input type="text" class="form-control" placeholder="Email" > required autofocus> > <input type="password" class="form-control" > placeholder="Password" required> > <button class="btn btn-lg btn-primary btn-block" type="submit"> > Sign in</button> > <label class="checkbox pull-left"> > <input type="checkbox" value="remember-me"> > Remember me > </label> > <a href="#" class="pull-right need-help">Need help? > </a><span class="clearfix"></span> > </form> > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/3aa17d90-3959-4b16-8c14-93c966fb45d0%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/3aa17d90-3959-4b16-8c14-93c966fb45d0%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- []'s Daniel Germano Travieso Engenharia de Computação UNICAMP -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABF8kZOMvAq8FruUKc6kQ%2Bbyq_G%3Dz9%3DJ38_LCM5A0PgE0zppOA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

