Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django - {% load url from future %} yields error "'url' is not a valid tag library"

I'm trying to reuse the template shown here as a basis for my login page but when I run it I get this error:

'url' is not a valid tag library

Is there some special setting I need to do?

The offending line in the template is:

{% load url from future %}

I'm on Django 1.2 if it matters.

like image 490
Greg Avatar asked Apr 13 '11 17:04

Greg


2 Answers

In django 1.9 the url tag is loaded by default so you can simply remove the load statement.

RemovedInDjango19Warning: Loading the `url` tag from the `future` library is deprecated and will be removed in Django 1.9. Use the default `url` tag instead.

like image 83
frmdstryr Avatar answered Nov 05 '22 05:11

frmdstryr


1.3 docs

vs

1.2 docs

There is no {% load url from future %} until django 1.3.

use this from the 1.2 docs:

{% extends "base.html" %}

{% block content %}

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

<form method="post" action="{% url django.contrib.auth.views.login %}">
{% csrf_token %}
<table>
<tr>
    <td>{{ form.username.label_tag }}</td>
    <td>{{ form.username }}</td>
</tr>
<tr>
    <td>{{ form.password.label_tag }}</td>
    <td>{{ form.password }}</td>
</tr>
</table>

<input type="submit" value="login" />
<input type="hidden" name="next" value="{{ next }}" />
</form>

{% endblock %}
like image 26
dting Avatar answered Nov 05 '22 05:11

dting