Re: bootstrap to the login template

2018-06-07 Thread G.R. Nobles
I went down the  django-widget-tweaks route to solve it. Thanks.


  

  Sign in
  
https://lh5.googleusercontent.com/-b0-k99FZlyE/AAI/AAA/eu7opA4byxI/photo.jpg?sz=120";
 
 alt="">
{% block content %}
{% load widget_tweaks %}

{% if form.errors %}
Your username and password didn't match. Please try again.
{% endif %}

{% if next %}
{% if user.is_authenticated %}
Your account doesn't have access to this page. To proceed,
  please login with an account that has access.
  {% else %}
  Please login to see this page.
  {% endif %}
  {% endif %}
  
{% csrf_token %}

  {{ 
form.username|add_class:"form-control"|append_attr:"placeholder:Username" }}


  {{ 
form.password|add_class:"form-control"|append_attr:"placeholder:Password" }}


  
Sign in

  

{# Assumes you setup the password_reset view in your URLconf #}
Lost password?
{% endblock %}
  

  

  




On Thursday, 7 June 2018 00:42:40 UTC+2, Daniel Germano Travieso wrote:
>
> 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 > 
> 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 %}
>> Your username and password didn't match. Please try again.
>> {% endif %}
>> 
>> {% if next %}
>> {% if user.is_authenticated %}
>> Your account doesn't have access to this page. To proceed,
>>   please login with an account that has access.
>>   {% else %}
>>   Please login to see this page.
>>   {% endif %}
>>   {% endif %}
>>   
>>   
>> {% csrf_token %}
>> 
>>   {{ form.username.label_tag }}
>>   {{ form.username }}
>> 
>> 
>>   {{ form.password.label_tag }}
>>   {{ form.password }}
>> 
>>   
>>   
>> 
>>   
>>   
>> 
>> > required autofocus>
>> > placeholder="Password" required>
>> > type="submit">
>>   Sign in
>>   
>> 
>> Remember me
>>   
>>   Need help? 
>> 
>> 
>>
>>
>> -- 
>> 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 django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> 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
>>  
>> 
>> .
>> 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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/dja

Re: bootstrap to the login template

2018-06-07 Thread C. Kirby
I do it this way (Note this is Bootstrap 4a3 and I do some offer the error 
indication differently




{% 
csrf_token %}

Login


{% if form.errors %}

Incorrect Login. Please Try Again


{% endif %}
















New User










Kirby

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/c7175dbb-08fc-4fe6-b0dc-a490917e6347%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: bootstrap to the login template

2018-06-07 Thread C. Kirby




{% 
csrf_token %}

Login


{% if form.errors %}

Incorrect Login. Please Try 
Again

{% endif %}
















New User








-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/e1c94b9e-d3b8-4099-afe7-a7230a698975%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: bootstrap to the login template

2018-06-07 Thread Melvyn Sopacua
On woensdag 6 juni 2018 22:58:50 CEST G.R. Nobles 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).

I find this difficult to answer, because you mention "apply" and "integrate" 
bootstrap. You have a certain expectation there.

What is that expectation?

-- 
Melvyn Sopacua

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/1650404.2fMrPQvyA6%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: bootstrap to the login template

2018-06-06 Thread Daniel Germano Travieso
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  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 %}
> Your username and password didn't match. Please try again.
> {% endif %}
>
> {% if next %}
> {% if user.is_authenticated %}
> Your account doesn't have access to this page. To proceed,
>   please login with an account that has access.
>   {% else %}
>   Please login to see this page.
>   {% endif %}
>   {% endif %}
>
>   
> {% csrf_token %}
> 
>   {{ form.username.label_tag }}
>   {{ form.username }}
> 
> 
>   {{ form.password.label_tag }}
>   {{ form.password }}
> 
>   
>   
> 
>   
>   
> 
>  required autofocus>
>  placeholder="Password" required>
> 
>   Sign in
>   
> 
> Remember me
>   
>   Need help?
> 
> 
>
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> 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
> 
> .
> 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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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.


bootstrap to the login template

2018-06-06 Thread G.R. Nobles
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 %}
Your username and password didn't match. Please try again.
{% endif %}

{% if next %}
{% if user.is_authenticated %}
Your account doesn't have access to this page. To proceed,
  please login with an account that has access.
  {% else %}
  Please login to see this page.
  {% endif %}
  {% endif %}
  
  
{% csrf_token %}

  {{ form.username.label_tag }}
  {{ form.username }}


  {{ form.password.label_tag }}
  {{ form.password }}

  
  

  
  




  Sign in
  

Remember me
  
  Need help? 



-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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.
For more options, visit https://groups.google.com/d/optout.