Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Authentication Authentication LoginView

Cheo R
Cheo R
37,150 Points

Django Authentication- LoginView, Challenge Task 2 of 2, Task 1 no longer passing, code review help?

Would like guidance on what is causing my code to fail.

The first task of the challenge is to add a new route for r"^" that includes Django's auth URLs.

urlpatterns = [ url(r'^', include('django.contrib.auth.urls')), ]

The second task is to update the login template. Add the appropriate HTML to display theform to the template and an <h1> that says "Log into your account".

Which I thought I did correctly, but received the error message that the first task is no longer passing. Is there something I'm missing?

accounts/urls.py
from django.conf.urls import url, include

from . import views

urlpatterns = [
    url('^', include('django.contrib.auth.urls')),
]
templates/registration/login.html
{% extends "layout.html" %}
{% load bootstrap3 %}

{% block title_tag %}Login | {{ block.super }}{{% endblock %}

{% block body_content %}
<div class="container">
  <h1>Log into your account</h1>
  <form method="POST">
    {% csrf_token %}
    {% bootstrap_form form %}
    <input type="submit" value="Login" class="btn btn-default">
  </form>  
</div>
{% endblock %}

1 Answer

Literally just did this challenge myself. You're just overthinking the template.

<h1>Log into your account</h1>
<form method="POST">
  {% csrf_token %}
  {{ form.as_p }}
  <input type="submit" value="Log in">
</form>
Bernardo Augusto García Loaiza
Bernardo Augusto García Loaiza
Courses Plus Student 792 Points

I understand, the system check the answer in the task 2 in relation to the way in which Django will do, without bootstrap form ... and so.