Ad

Django Doesn't Seem To Detect My Login.html, Block Problem?

I'm creating a web app with django 1.2.4.

I am using contrib.auth.views.login, I have followed every step but it seems I have forgotten something cause I don't see the login form. Here is my folder structure:

/templates/
    base.html
    /myapp/
        object_list.html
        ...
    /registration/
        login.html

...and here is my login.html:

{% extends "base.html" %}
{% block mylogin %}
<div class="horizontal">
    {% if form.errors %}
        <p>Your username and password didn't match. Please try again.</p>
    {% endif %}
    <form action="{% url django.contrib.auth.views.login %}" method="post">
        {% csrf_token %}
        <div class="login_box">
            <div class="login_text">{{ form.username.label_tag }}</div><div class="login_input">{{ form.username }}</div>
            <div class="password_text">{{ form.password.label_tag }}</div><div class="password_input">{{ form.password }}</div>
            <input id="button_login" type="submit" value="" />
        </div>
    </form>
</div>
{% endblock %}

...and in my base.html I have:

<div id="some_div">
{% block mylogin %} {% endblock %}
</div>

I have a basestyle.css included in base.html and the other templates inherit correctly too... it seems to be a block problem...

Any solution?? Thnak you

Ad

Answer

Instead of inserting of a block I used the include tag in base.html, just like this:

{% include "registration/login.html" %}
Ad
source: stackoverflow.com
Ad