url tag: "'str' object has no attribute 'regex'"

1,596 views
Skip to first unread message

refreegrata

unread,
May 17, 2012, 5:58:28 PM5/17/12
to django...@googlegroups.com
Hello list

I know, this question has been posted and resolved before, but the solutions don't work in my situation. I don't know why.

When I try to use the "url" tag in any template an exception is raised:
"'str' object has no attribute 'regex'"

for example, with this I got the error:
------------------------------------
urls.py (main)
-------------------------------------
from django.conf.urls import patterns, include, url

urlpatterns= patterns('',
    (r'^registration/', include('apps.registration.urls')),
    (r'', 'django.contrib.auth.views.login'),
)
-------------------------------------

urls.py (registration)
-----------------------------------------
from django.conf.urls import patterns, include, url

urlpatterns= patterns('',
    (r'^login/$', 'django.contrib.auth.views.login'),
)
-----------------------------------------

login.html (in templates/registration)
-------------------------------------------------------------
{{ form }}
{% url "django.contrib.auth.views.login" %} <---here is the problem. It's just an stupid test for the problem
-------------------------------------------------------------

Fail with:
 - {% url django.contrib.auth.views.login %}
 - {% url 'django.contrib.auth.views.login' %}
 - {% url "django.contrib.auth.views.login" %}

I add this at the end of the file "settings.py":
----------------------------------------------------------
import django.template
django.template.add_to_builtins('django.templatetags.future')
----------------------------------------------------------
Including or excluding the last lines doesn't matter. The problem appear in the both cases.

I'm using Django 1.4, and Python 2.6 over Centos 6.2. Maybe I must to include something else in the settings?

Thanks for read and sorry for my bad english.












Reply all
Reply to author
Forward
0 new messages