summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/contrib/admin/templates/admin/500.html1
-rw-r--r--django/contrib/admin/templates/admin/app_index.html1
-rw-r--r--django/contrib/admin/templates/admin/auth/user/change_password.html1
-rw-r--r--django/contrib/admin/templates/admin/base.html2
-rw-r--r--django/contrib/admin/templates/admin/change_form.html1
-rw-r--r--django/contrib/admin/templates/admin/change_list.html1
-rw-r--r--django/contrib/admin/templates/admin/delete_confirmation.html1
-rw-r--r--django/contrib/admin/templates/admin/delete_selected_confirmation.html1
-rw-r--r--django/contrib/admin/templates/admin/invalid_setup.html1
-rw-r--r--django/contrib/admin/templates/admin/login.html1
-rw-r--r--django/contrib/admin/templates/admin/object_history.html1
-rw-r--r--django/contrib/admin/templates/registration/logged_out.html1
-rw-r--r--django/contrib/admin/templates/registration/password_change_done.html1
-rw-r--r--django/contrib/admin/templates/registration/password_change_form.html1
-rw-r--r--django/contrib/admin/templates/registration/password_reset_complete.html1
-rw-r--r--django/contrib/admin/templates/registration/password_reset_confirm.html1
-rw-r--r--django/contrib/admin/templates/registration/password_reset_done.html1
-rw-r--r--django/contrib/admin/templates/registration/password_reset_email.html2
-rw-r--r--django/contrib/admin/templates/registration/password_reset_form.html1
-rw-r--r--django/contrib/admindocs/templates/admin_doc/bookmarklets.html1
-rw-r--r--django/contrib/admindocs/templates/admin_doc/index.html1
-rw-r--r--django/contrib/admindocs/templates/admin_doc/missing_docutils.html1
-rw-r--r--django/contrib/admindocs/templates/admin_doc/model_detail.html1
-rw-r--r--django/contrib/admindocs/templates/admin_doc/model_index.html1
-rw-r--r--django/contrib/admindocs/templates/admin_doc/template_detail.html1
-rw-r--r--django/contrib/admindocs/templates/admin_doc/template_filter_index.html1
-rw-r--r--django/contrib/admindocs/templates/admin_doc/template_tag_index.html1
-rw-r--r--django/contrib/admindocs/templates/admin_doc/view_detail.html1
-rw-r--r--django/contrib/admindocs/templates/admin_doc/view_index.html1
-rw-r--r--django/contrib/auth/tests/templates/context_processors/auth_attrs_user.html2
-rw-r--r--django/template/defaulttags.py109
-rw-r--r--django/templatetags/future.py122
32 files changed, 54 insertions, 210 deletions
diff --git a/django/contrib/admin/templates/admin/500.html b/django/contrib/admin/templates/admin/500.html
index eeb9e8da79..9a3b636346 100644
--- a/django/contrib/admin/templates/admin/500.html
+++ b/django/contrib/admin/templates/admin/500.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block breadcrumbs %}
<div class="breadcrumbs">
diff --git a/django/contrib/admin/templates/admin/app_index.html b/django/contrib/admin/templates/admin/app_index.html
index 4616b16d3d..9f65357292 100644
--- a/django/contrib/admin/templates/admin/app_index.html
+++ b/django/contrib/admin/templates/admin/app_index.html
@@ -1,6 +1,5 @@
{% extends "admin/index.html" %}
{% load i18n %}
-{% load url from future %}
{% if not is_popup %}
{% block breadcrumbs %}
diff --git a/django/contrib/admin/templates/admin/auth/user/change_password.html b/django/contrib/admin/templates/admin/auth/user/change_password.html
index 6adfaed548..4fdccd13d2 100644
--- a/django/contrib/admin/templates/admin/auth/user/change_password.html
+++ b/django/contrib/admin/templates/admin/auth/user/change_password.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n admin_static admin_modify %}
-{% load url from future %}
{% load admin_urls %}
{% block extrahead %}{{ block.super }}
diff --git a/django/contrib/admin/templates/admin/base.html b/django/contrib/admin/templates/admin/base.html
index 3b50adcd6e..6e2de51440 100644
--- a/django/contrib/admin/templates/admin/base.html
+++ b/django/contrib/admin/templates/admin/base.html
@@ -1,4 +1,4 @@
-{% load admin_static %}{% load url from future %}<!DOCTYPE html>
+{% load admin_static %}<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
<head>
<title>{% block title %}{% endblock %}</title>
diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html
index de442986ff..79c4f1bdf4 100644
--- a/django/contrib/admin/templates/admin/change_form.html
+++ b/django/contrib/admin/templates/admin/change_form.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n admin_static admin_modify %}
-{% load url from future %}
{% load admin_urls %}
{% block extrahead %}{{ block.super }}
diff --git a/django/contrib/admin/templates/admin/change_list.html b/django/contrib/admin/templates/admin/change_list.html
index 98869cfa5c..3c73ac8745 100644
--- a/django/contrib/admin/templates/admin/change_list.html
+++ b/django/contrib/admin/templates/admin/change_list.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n admin_static admin_list %}
-{% load url from future %}
{% load admin_urls %}
{% block extrastyle %}
diff --git a/django/contrib/admin/templates/admin/delete_confirmation.html b/django/contrib/admin/templates/admin/delete_confirmation.html
index 43440b2774..71d3eb9f0f 100644
--- a/django/contrib/admin/templates/admin/delete_confirmation.html
+++ b/django/contrib/admin/templates/admin/delete_confirmation.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% load admin_urls %}
{% block breadcrumbs %}
diff --git a/django/contrib/admin/templates/admin/delete_selected_confirmation.html b/django/contrib/admin/templates/admin/delete_selected_confirmation.html
index 3120cc5289..608052d6f5 100644
--- a/django/contrib/admin/templates/admin/delete_selected_confirmation.html
+++ b/django/contrib/admin/templates/admin/delete_selected_confirmation.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n l10n %}
-{% load url from future %}
{% load admin_urls %}
{% block breadcrumbs %}
diff --git a/django/contrib/admin/templates/admin/invalid_setup.html b/django/contrib/admin/templates/admin/invalid_setup.html
index c2df4df7f0..7c711072d6 100644
--- a/django/contrib/admin/templates/admin/invalid_setup.html
+++ b/django/contrib/admin/templates/admin/invalid_setup.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block breadcrumbs %}
<div class="breadcrumbs">
diff --git a/django/contrib/admin/templates/admin/login.html b/django/contrib/admin/templates/admin/login.html
index c008957d1b..06fe4c8160 100644
--- a/django/contrib/admin/templates/admin/login.html
+++ b/django/contrib/admin/templates/admin/login.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n admin_static %}
-{% load url from future %}
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/login.css" %}" />{% endblock %}
diff --git a/django/contrib/admin/templates/admin/object_history.html b/django/contrib/admin/templates/admin/object_history.html
index ebd19609cd..2c353374f6 100644
--- a/django/contrib/admin/templates/admin/object_history.html
+++ b/django/contrib/admin/templates/admin/object_history.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% load admin_urls %}
{% block breadcrumbs %}
diff --git a/django/contrib/admin/templates/registration/logged_out.html b/django/contrib/admin/templates/registration/logged_out.html
index e95d864803..6a18186f7f 100644
--- a/django/contrib/admin/templates/registration/logged_out.html
+++ b/django/contrib/admin/templates/registration/logged_out.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block breadcrumbs %}<div class="breadcrumbs"><a href="{% url 'admin:index' %}">{% trans 'Home' %}</a></div>{% endblock %}
diff --git a/django/contrib/admin/templates/registration/password_change_done.html b/django/contrib/admin/templates/registration/password_change_done.html
index 863fc9671d..1c928a0d4d 100644
--- a/django/contrib/admin/templates/registration/password_change_done.html
+++ b/django/contrib/admin/templates/registration/password_change_done.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %}{% trans 'Change password' %} / <a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
diff --git a/django/contrib/admin/templates/registration/password_change_form.html b/django/contrib/admin/templates/registration/password_change_form.html
index ea8abb4112..5cb34739df 100644
--- a/django/contrib/admin/templates/registration/password_change_form.html
+++ b/django/contrib/admin/templates/registration/password_change_form.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n static %}
-{% load url from future %}
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />{% endblock %}
{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %} {% trans 'Change password' %} / <a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>{% endblock %}
{% block breadcrumbs %}
diff --git a/django/contrib/admin/templates/registration/password_reset_complete.html b/django/contrib/admin/templates/registration/password_reset_complete.html
index 7c07707f09..d97f338197 100644
--- a/django/contrib/admin/templates/registration/password_reset_complete.html
+++ b/django/contrib/admin/templates/registration/password_reset_complete.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block breadcrumbs %}
<div class="breadcrumbs">
diff --git a/django/contrib/admin/templates/registration/password_reset_confirm.html b/django/contrib/admin/templates/registration/password_reset_confirm.html
index d5299ebd91..81020b929f 100644
--- a/django/contrib/admin/templates/registration/password_reset_confirm.html
+++ b/django/contrib/admin/templates/registration/password_reset_confirm.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block breadcrumbs %}
<div class="breadcrumbs">
diff --git a/django/contrib/admin/templates/registration/password_reset_done.html b/django/contrib/admin/templates/registration/password_reset_done.html
index fd73af8928..3c9796e63c 100644
--- a/django/contrib/admin/templates/registration/password_reset_done.html
+++ b/django/contrib/admin/templates/registration/password_reset_done.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block breadcrumbs %}
<div class="breadcrumbs">
diff --git a/django/contrib/admin/templates/registration/password_reset_email.html b/django/contrib/admin/templates/registration/password_reset_email.html
index de9dc79c52..4f002fe5bb 100644
--- a/django/contrib/admin/templates/registration/password_reset_email.html
+++ b/django/contrib/admin/templates/registration/password_reset_email.html
@@ -1,4 +1,4 @@
-{% load i18n %}{% load url from future %}{% autoescape off %}
+{% load i18n %}{% autoescape off %}
{% blocktrans %}You're receiving this e-mail because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %}
{% trans "Please go to the following page and choose a new password:" %}
diff --git a/django/contrib/admin/templates/registration/password_reset_form.html b/django/contrib/admin/templates/registration/password_reset_form.html
index 2b591fe22e..ca9ff115bc 100644
--- a/django/contrib/admin/templates/registration/password_reset_form.html
+++ b/django/contrib/admin/templates/registration/password_reset_form.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block breadcrumbs %}
<div class="breadcrumbs">
diff --git a/django/contrib/admindocs/templates/admin_doc/bookmarklets.html b/django/contrib/admindocs/templates/admin_doc/bookmarklets.html
index baa717c4b3..cde285481d 100644
--- a/django/contrib/admindocs/templates/admin_doc/bookmarklets.html
+++ b/django/contrib/admindocs/templates/admin_doc/bookmarklets.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block breadcrumbs %}
<div class="breadcrumbs">
diff --git a/django/contrib/admindocs/templates/admin_doc/index.html b/django/contrib/admindocs/templates/admin_doc/index.html
index 652fbfd576..5347341dc0 100644
--- a/django/contrib/admindocs/templates/admin_doc/index.html
+++ b/django/contrib/admindocs/templates/admin_doc/index.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block breadcrumbs %}
<div class="breadcrumbs">
diff --git a/django/contrib/admindocs/templates/admin_doc/missing_docutils.html b/django/contrib/admindocs/templates/admin_doc/missing_docutils.html
index 6843bab918..f8a68ce04c 100644
--- a/django/contrib/admindocs/templates/admin_doc/missing_docutils.html
+++ b/django/contrib/admindocs/templates/admin_doc/missing_docutils.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block breadcrumbs %}
<div class="breadcrumbs">
diff --git a/django/contrib/admindocs/templates/admin_doc/model_detail.html b/django/contrib/admindocs/templates/admin_doc/model_detail.html
index 82cb405639..9fb4eeea14 100644
--- a/django/contrib/admindocs/templates/admin_doc/model_detail.html
+++ b/django/contrib/admindocs/templates/admin_doc/model_detail.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block extrahead %}
{{ block.super }}
diff --git a/django/contrib/admindocs/templates/admin_doc/model_index.html b/django/contrib/admindocs/templates/admin_doc/model_index.html
index 4eb3cf69c9..7a8c69953e 100644
--- a/django/contrib/admindocs/templates/admin_doc/model_index.html
+++ b/django/contrib/admindocs/templates/admin_doc/model_index.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block coltype %}colSM{% endblock %}
diff --git a/django/contrib/admindocs/templates/admin_doc/template_detail.html b/django/contrib/admindocs/templates/admin_doc/template_detail.html
index 307dd627df..27fca28b4b 100644
--- a/django/contrib/admindocs/templates/admin_doc/template_detail.html
+++ b/django/contrib/admindocs/templates/admin_doc/template_detail.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block breadcrumbs %}
<div class="breadcrumbs">
diff --git a/django/contrib/admindocs/templates/admin_doc/template_filter_index.html b/django/contrib/admindocs/templates/admin_doc/template_filter_index.html
index 1809bc9182..1878e806f4 100644
--- a/django/contrib/admindocs/templates/admin_doc/template_filter_index.html
+++ b/django/contrib/admindocs/templates/admin_doc/template_filter_index.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block coltype %}colSM{% endblock %}
{% block breadcrumbs %}
diff --git a/django/contrib/admindocs/templates/admin_doc/template_tag_index.html b/django/contrib/admindocs/templates/admin_doc/template_tag_index.html
index 18e5d95298..568b118826 100644
--- a/django/contrib/admindocs/templates/admin_doc/template_tag_index.html
+++ b/django/contrib/admindocs/templates/admin_doc/template_tag_index.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block coltype %}colSM{% endblock %}
{% block breadcrumbs %}
diff --git a/django/contrib/admindocs/templates/admin_doc/view_detail.html b/django/contrib/admindocs/templates/admin_doc/view_detail.html
index 41c812110f..efe5fed9ed 100644
--- a/django/contrib/admindocs/templates/admin_doc/view_detail.html
+++ b/django/contrib/admindocs/templates/admin_doc/view_detail.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block breadcrumbs %}
<div class="breadcrumbs">
diff --git a/django/contrib/admindocs/templates/admin_doc/view_index.html b/django/contrib/admindocs/templates/admin_doc/view_index.html
index e508c84e19..86342c6dd4 100644
--- a/django/contrib/admindocs/templates/admin_doc/view_index.html
+++ b/django/contrib/admindocs/templates/admin_doc/view_index.html
@@ -1,6 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
-{% load url from future %}
{% block coltype %}colSM{% endblock %}
{% block breadcrumbs %}
diff --git a/django/contrib/auth/tests/templates/context_processors/auth_attrs_user.html b/django/contrib/auth/tests/templates/context_processors/auth_attrs_user.html
index 5df2a344cc..aa7f784405 100644
--- a/django/contrib/auth/tests/templates/context_processors/auth_attrs_user.html
+++ b/django/contrib/auth/tests/templates/context_processors/auth_attrs_user.html
@@ -1,4 +1,4 @@
-{% load url from future %}unicode: {{ user }}
+unicode: {{ user }}
id: {{ user.id }}
username: {{ user.username }}
url: {% url 'userpage' user %}
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py
index 954c5d6d19..f0a83d7e9a 100644
--- a/django/template/defaulttags.py
+++ b/django/template/defaulttags.py
@@ -315,15 +315,12 @@ def include_is_allowed(filepath):
return False
class SsiNode(Node):
- def __init__(self, filepath, parsed, legacy_filepath=True):
+ def __init__(self, filepath, parsed):
self.filepath = filepath
self.parsed = parsed
- self.legacy_filepath = legacy_filepath
def render(self, context):
- filepath = self.filepath
- if not self.legacy_filepath:
- filepath = filepath.resolve(context)
+ filepath = self.filepath.resolve(context)
if not include_is_allowed(filepath):
if settings.DEBUG:
@@ -385,9 +382,8 @@ class TemplateTagNode(Node):
return self.mapping.get(self.tagtype, '')
class URLNode(Node):
- def __init__(self, view_name, args, kwargs, asvar, legacy_view_name=True):
+ def __init__(self, view_name, args, kwargs, asvar):
self.view_name = view_name
- self.legacy_view_name = legacy_view_name
self.args = args
self.kwargs = kwargs
self.asvar = asvar
@@ -398,9 +394,7 @@ class URLNode(Node):
kwargs = dict([(smart_str(k, 'ascii'), v.resolve(context))
for k, v in self.kwargs.items()])
- view_name = self.view_name
- if not self.legacy_view_name:
- view_name = view_name.resolve(context)
+ view_name = self.view_name.resolve(context)
# Try to look up the URL twice: once given the view name, and again
# relative to what we guess is the "main" app. If they both fail,
@@ -969,19 +963,14 @@ def ssi(parser, token):
of another file -- which must be specified using an absolute path --
in the current page::
- {% ssi /home/html/ljworld.com/includes/right_generic.html %}
+ {% ssi "/home/html/ljworld.com/includes/right_generic.html" %}
If the optional "parsed" parameter is given, the contents of the included
file are evaluated as template code, with the current context::
- {% ssi /home/html/ljworld.com/includes/right_generic.html parsed %}
+ {% ssi "/home/html/ljworld.com/includes/right_generic.html" parsed %}
"""
-
- import warnings
- warnings.warn('The syntax for the ssi template tag is changing. Load the `ssi` tag from the `future` tag library to start using the new behavior.',
- category=DeprecationWarning)
-
- bits = token.contents.split()
+ bits = token.split_contents()
parsed = False
if len(bits) not in (2, 3):
raise TemplateSyntaxError("'ssi' tag takes one argument: the path to"
@@ -992,7 +981,8 @@ def ssi(parser, token):
else:
raise TemplateSyntaxError("Second (optional) argument to %s tag"
" must be 'parsed'" % bits[0])
- return SsiNode(bits[1], parsed, legacy_filepath=True)
+ filepath = parser.compile_filter(bits[1])
+ return SsiNode(filepath, parsed)
@register.tag
def load(parser, token):
@@ -1201,17 +1191,21 @@ def url(parser, token):
This is a way to define links that aren't tied to a particular URL
configuration::
- {% url path.to.some_view arg1 arg2 %}
+ {% url "path.to.some_view" arg1 arg2 %}
or
- {% url path.to.some_view name1=value1 name2=value2 %}
+ {% url "path.to.some_view" name1=value1 name2=value2 %}
- The first argument is a path to a view. It can be an absolute python path
+ The first argument is a path to a view. It can be an absolute Python path
or just ``app_name.view_name`` without the project name if the view is
- located inside the project. Other arguments are comma-separated values
- that will be filled in place of positional and keyword arguments in the
- URL. All arguments for the URL should be present.
+ located inside the project.
+
+ Other arguments are space-separated values that will be filled in place of
+ positional and keyword arguments in the URL. Don't mix positional and
+ keyword arguments.
+
+ All arguments for the URL should be present.
For example if you have a view ``app_name.client`` taking client's id and
the corresponding line in a URLconf looks like this::
@@ -1225,20 +1219,39 @@ def url(parser, token):
then in a template you can create a link for a certain client like this::
- {% url app_name.client client.id %}
+ {% url "app_name.client" client.id %}
The URL will look like ``/clients/client/123/``.
- """
- import warnings
- warnings.warn('The syntax for the url template tag is changing. Load the `url` tag from the `future` tag library to start using the new behavior.',
- category=DeprecationWarning)
+ The first argument can also be a named URL instead of the Python path to
+ the view callable. For example if the URLconf entry looks like this::
+
+ url('^client/(\d+)/$', name='client-detail-view')
+
+ then in the template you can use::
+
+ {% url "client-detail-view" client.id %}
+
+ There is even another possible value type for the first argument. It can be
+ the name of a template variable that will be evaluated to obtain the view
+ name or the URL name, e.g.::
+ {% with view_path="app_name.client" %}
+ {% url view_path client.id %}
+ {% endwith %}
+
+ or,
+
+ {% with url_name="client-detail-view" %}
+ {% url url_name client.id %}
+ {% endwith %}
+
+ """
bits = token.split_contents()
if len(bits) < 2:
raise TemplateSyntaxError("'%s' takes at least one argument"
" (path to a view)" % bits[0])
- viewname = bits[1]
+ viewname = parser.compile_filter(bits[1])
args = []
kwargs = {}
asvar = None
@@ -1247,38 +1260,6 @@ def url(parser, token):
asvar = bits[-1]
bits = bits[:-2]
- # Backwards compatibility: check for the old comma separated format
- # {% url urlname arg1,arg2 %}
- # Initial check - that the first space separated bit has a comma in it
- if bits and ',' in bits[0]:
- check_old_format = True
- # In order to *really* be old format, there must be a comma
- # in *every* space separated bit, except the last.
- for bit in bits[1:-1]:
- if ',' not in bit:
- # No comma in this bit. Either the comma we found
- # in bit 1 was a false positive (e.g., comma in a string),
- # or there is a syntax problem with missing commas
- check_old_format = False
- break
- else:
- # No comma found - must be new format.
- check_old_format = False
-
- if check_old_format:
- # Confirm that this is old format by trying to parse the first
- # argument. An exception will be raised if the comma is
- # unexpected (i.e. outside of a static string).
- match = kwarg_re.match(bits[0])
- if match:
- value = match.groups()[1]
- try:
- parser.compile_filter(value)
- except TemplateSyntaxError:
- bits = ''.join(bits).split(',')
-
- # Now all the bits are parsed into new format,
- # process them as template vars
if len(bits):
for bit in bits:
match = kwarg_re.match(bit)
@@ -1290,7 +1271,7 @@ def url(parser, token):
else:
args.append(parser.compile_filter(value))
- return URLNode(viewname, args, kwargs, asvar, legacy_view_name=True)
+ return URLNode(viewname, args, kwargs, asvar)
@register.tag
def widthratio(parser, token):
diff --git a/django/templatetags/future.py b/django/templatetags/future.py
index 9fb2d1138f..e6a0127e71 100644
--- a/django/templatetags/future.py
+++ b/django/templatetags/future.py
@@ -1,124 +1,14 @@
-from django.template import Library, TemplateSyntaxError
-from django.template.defaulttags import kwarg_re, SsiNode, URLNode
+from django.template import Library
+from django.template.defaulttags import url as default_url, ssi as default_ssi
register = Library()
@register.tag
def ssi(parser, token):
- """
- Outputs the contents of a given file into the page.
-
- Like a simple "include" tag, the ``ssi`` tag includes the contents
- of another file -- which must be specified using an absolute path --
- in the current page::
-
- {% ssi "/home/html/ljworld.com/includes/right_generic.html" %}
-
- If the optional "parsed" parameter is given, the contents of the included
- file are evaluated as template code, with the current context::
-
- {% ssi "/home/html/ljworld.com/includes/right_generic.html" parsed %}
- """
- bits = token.split_contents()
- parsed = False
- if len(bits) not in (2, 3):
- raise TemplateSyntaxError("'ssi' tag takes one argument: the path to"
- " the file to be included")
- if len(bits) == 3:
- if bits[2] == 'parsed':
- parsed = True
- else:
- raise TemplateSyntaxError("Second (optional) argument to %s tag"
- " must be 'parsed'" % bits[0])
- filepath = parser.compile_filter(bits[1])
- return SsiNode(filepath, parsed, legacy_filepath=False)
+ # Used for deprecation path during 1.3/1.4, will be removed in 2.0
+ return default_ssi(parser, token)
@register.tag
def url(parser, token):
- """
- Returns an absolute URL matching given view with its parameters.
-
- This is a way to define links that aren't tied to a particular URL
- configuration::
-
- {% url "path.to.some_view" arg1 arg2 %}
-
- or
-
- {% url "path.to.some_view" name1=value1 name2=value2 %}
-
- The first argument is a path to a view. It can be an absolute Python path
- or just ``app_name.view_name`` without the project name if the view is
- located inside the project.
-
- Other arguments are space-separated values that will be filled in place of
- positional and keyword arguments in the URL. Don't mix positional and
- keyword arguments.
-
- All arguments for the URL should be present.
-
- For example if you have a view ``app_name.client`` taking client's id and
- the corresponding line in a URLconf looks like this::
-
- ('^client/(\d+)/$', 'app_name.client')
-
- and this app's URLconf is included into the project's URLconf under some
- path::
-
- ('^clients/', include('project_name.app_name.urls'))
-
- then in a template you can create a link for a certain client like this::
-
- {% url "app_name.client" client.id %}
-
- The URL will look like ``/clients/client/123/``.
-
- The first argument can also be a named URL instead of the Python path to
- the view callable. For example if the URLconf entry looks like this::
-
- url('^client/(\d+)/$', name='client-detail-view')
-
- then in the template you can use::
-
- {% url "client-detail-view" client.id %}
-
- There is even another possible value type for the first argument. It can be
- the name of a template variable that will be evaluated to obtain the view
- name or the URL name, e.g.::
-
- {% with view_path="app_name.client" %}
- {% url view_path client.id %}
- {% endwith %}
-
- or,
-
- {% with url_name="client-detail-view" %}
- {% url url_name client.id %}
- {% endwith %}
-
- """
- bits = token.split_contents()
- if len(bits) < 2:
- raise TemplateSyntaxError("'%s' takes at least one argument"
- " (path to a view)" % bits[0])
- viewname = parser.compile_filter(bits[1])
- args = []
- kwargs = {}
- asvar = None
- bits = bits[2:]
- if len(bits) >= 2 and bits[-2] == 'as':
- asvar = bits[-1]
- bits = bits[:-2]
-
- if len(bits):
- for bit in bits:
- match = kwarg_re.match(bit)
- if not match:
- raise TemplateSyntaxError("Malformed arguments to url tag")
- name, value = match.groups()
- if name:
- kwargs[name] = parser.compile_filter(value)
- else:
- args.append(parser.compile_filter(value))
-
- return URLNode(viewname, args, kwargs, asvar, legacy_view_name=False)
+ # Used for deprecation path during 1.3/1.4, will be removed in 2.0
+ return default_url(parser, token)