Skip to main content

django-future-url

https://travis-ci.org/futurecolors/django-future-url.png?branch=master

Migration tool for old style “url” tags in Django 1.3 & 1.4. Support for Django 1.5 in next version. “In Django 1.5, the behavior of the url template tag will change”

If you use old style url tags in django 1.4 you will see that: “DeprecationWarning: The syntax for the url template tag is changing. Load the url tag from the future tag library to start using the new behavior.”

The new library also drops support for the comma syntax for separating arguments to the url template tag.

In Django 1.5, the old behavior will be replaced with the behavior provided by the future tag library. Existing templates be migrated to use the new syntax.

How it works

  • Finds all \*.html, \*.txt files.

  • Replaces all old style “url” tags.

  • Inserts {% load url from future %} when it’s needed.

Installation

$ pip install django-future-url

Usage

$ cd ~/projects/my_django_14_project/
$ future_url

It will show needed midification for all templates in directory “~/projects/my_django_14_project/” and subdirectories.:

$ future_url --write

It will modernize all your templates in place (see above).

Options

You can use future_url --help for help.

Only shows changes to be made without actually modifying files:

$ future_url

Example

$ cat ./template1.html

{% url path.to.view arg arg2 %}
{%  url path.to.view arg arg2 %}
{%url myapp:view-name %}
{% url path.to.view as the_url%}
{% url   path.to.view arg arg2   as   the_url %}
{%url app_views.client client.id%}
$ future_url --write

$ cat ./template1.html

{% load url from future %}
{% url 'path.to.view' arg arg2 %}
{%  url 'path.to.view' arg arg2 %}
{%url 'myapp:view-name' %}
{% url 'path.to.view' as the_url%}
{% url   'path.to.view' arg arg2   as   the_url %}

Tests

Install python setup.py test and cram django_future_url/test/cram

Release files for django-future-url 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-future-url 0.2.2
File Size Uploaded
django-future-url-0.2.2.zip 10.5 kB Details

Release files / django-future-url-0.2.2.zip

Download URL django-future-url-0.2.2.zip
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fce9cde2da170284cf7f540eb20db857ceb5adbf2dff61ee77974b42fb526f54
BLAKE2b-256 checksum
How to use checksums
4b5120cd8e090d82bf38671643545ec744203b73029631b42653e4e51c64c5e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.2 This release

1 release file

0.2.1

1 release file

0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page