0

Django 1.5, using the app

localeurl

With urlpattern like so :

urlpatterns += i18n_patterns(
    url(r'^user/login/?$','django.contrib.auth.views.login',\
          {'template_name':'user/login.html'}),
)

and in the template, this

{% url 'django.contrib.auth.views.login' %}

prepends the language code twice . It outputs "en/en/user/login" .

Does anybody have an idea how to get rid of the double language code, or where this might come from ?

mfit
  • 807
  • 13
  • 28
  • 1
    "Normally" you shouldnt need to use an additional app with Django 1.5 to use localized url-patterns. Maybe Django and the localeurl both add a prefix. – Jingo Jun 05 '13 at 18:52
  • @Jingo, thank you, was unaware of that . However, without "localeurl", no language code at all is added to the url. – mfit Jun 05 '13 at 18:57
  • Make sure you load the appropriate middlewares. Cant remember them but its very well documented in the django online help/documentation. – Jingo Jun 05 '13 at 19:45

1 Answers1

0

The mistake was to add the same url-patterns with both

urlpatterns += patterns( ... ) and

urlpatterns += i18n_patterns( ... )

That caused said error. It works when the patterns are added only through i18n_patterns

Also, "localeurl" is not necessary (thanks @Jingo)

mfit
  • 807
  • 13
  • 28