Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving imports to adapt for latest django version #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions localeurl/templatetags/localeurl_tags.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from django import template
from django.template import Node, Token, TemplateSyntaxError
from django.template import resolve_variable
from django.template import Node, TemplateSyntaxError
from django.template.base import Token
from django.template import Variable
from django.template.defaultfilters import stringfilter
from django.templatetags import future
from django.template.defaulttags import url

from localeurl import utils

register = template.Library()



def chlocale(url, locale):
"""
Changes the URL's locale prefix if the path is not locale-independent.
Expand Down Expand Up @@ -52,7 +52,7 @@ def locale_url(parser, token):
raise TemplateSyntaxError("'%s' takes at least two arguments:"
" the locale and a view" % bits[0])
urltoken = Token(token.token_type, bits[0] + ' ' + ' '.join(bits[2:]))
urlnode = future.url(parser, urltoken)
urlnode = url(parser, urltoken)
return LocaleURLNode(bits[1], urlnode)


Expand All @@ -62,7 +62,7 @@ def __init__(self, locale, urlnode):
self.urlnode = urlnode

def render(self, context):
locale = resolve_variable(self.locale, context)
locale = Variable(self.locale).resolve(context)
if utils.supported_language(locale) is None:
raise ValueError("locale not in settings.LANGUAGES: %s" % locale)
path = self.urlnode.render(context)
Expand Down