I'm trying to use TemplateView.as_view()
in urls.py
then name it using ye olde templatetag url
. Should this work? Or am I just doing it wrong..? Or is it some of the legacy crap in my app interfering? I've got...
<li><a href="{% url "legal" %}">Terms and Conditions</a></li>
and
url(r'^legal/$', TemplateView.as_view(template_name="legal.html"), name="legal"),
Which yields
NoReverseMatch at /how-it-works/
Reverse for '"legal"' with arguments '()' and keyword arguments '{}' not found.
Seems to me this ain't ever gonna work this way.
How do we reverse urls with TemplateView
?
The code you have posted is syntactically correct, but there is something else interfering.
legal
in the exception message is very suspicious. A Django 1.5+ exception message would contain 'legal'
, not '"legal"'
for a URL that is not found by the dispatcher.Add more info if you continue to have problems so we can isolate further.
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With