Reputation: 37934
I am stuck on this thing.
urls.py
print 'test before'
urlpatterns = patterns('horoscopes.views',
url(r'^$', 'index', name="index"),
url(r'^(?P<sign_name>\w+)/(?P<sign_num>\d+)/$', 'horoscope_detail', name="horoscope_detail"),
)
print 'test after'
html
<a href="{% trans 'Capricorn' as capri %}{% url 'horoscope_detail' capri 0 %}">
Capri
</a>
views.py
def horoscope_detail(request, sign_name, sign_num):
# ...
I just keep getting:
Reverse for 'horoscope_detail' with arguments '(u'Capricorn', 0)' and keyword arguments '{}' not found. 0 pattern(s) tried: []
the "test before"
and "test after"
are being printed.
what am I doing wrong here? regexp seems to be correct, but really confusing..
Upvotes: 0
Views: 107
Reputation: 6796
As the Django CMS docs stated here: http://docs.django-cms.org/en/2.4.2/extending_cms/app_integration.html#application-and-instance-namespaces, the app namespace needs to be specified in order to successfully reverse urls. So something like this should work:
{% url 'myapp_name:horoscope_detail' capri 0 %}
Upvotes: 1