[Fixed]-Django โ€“ {% load url from future %} yields error "'url' is not a valid tag library"

9๐Ÿ‘

โœ…

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 %}
๐Ÿ‘คdting

23๐Ÿ‘

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.

๐Ÿ‘คfrmdstryr

Leave a comment