This is yet another question regarding the error:
Reverse for 'dataPoints' with arguments '()' and keyword arguments '{u'loadID': 5}' not found. 1 pattern(s) tried: [u'loads/dataPoints/']
I've sifted through scads of related post but can't seem to figure out what's going on. The problem is this: in an app using url namespaces, a view template fails with the above error when I try to pass keyword arguments to the url, but works if I use position arguments.
This is what is giving me the above error:
Top-level urls.py:
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
...
url(r'^loads/', include(sig.views.data_loads.urls_data_loads, namespace="loads")),
url(r'^authentication/', include(sig.views.authentication.urls_authentication, namespace="authentication")),
url(r'^account/', include(sig.views.account.urls_account, namespace="account")),
)
urls.py for "loads":
urlpatterns = patterns('',
url(r'^dataPoints', views.DataPoints.as_view(), name='dataPoints')
)
template.html:
<a href="{% url 'loads:dataPoints' loadID=5 %}">points</a>
Then it says it can't find the reverse. Based on some of the related threads I've found, I've tried:
- trying the link without quotes, i.e. {% url loads:dataPoints ... %} (it fails)
- tried different regex patterns, e.g. url(r'^dataPoints(.)*) (still can't find reverse)
I can easily work around this by using positional arguments but it's really bugging me that I can't figure it out. I've used keyword args like this in apps before, and I'm wondering if something is screwy because I'm using url namespaces? Either that or, more likely, I'm doing something completely boneheaded.
EDIT: Adding code for DataPoints view:
class DataPoints(TemplateView):
template_name = "data_loads/templates/dataPoints.html"
def get(self, request):
loadID = request.GET["loadID"]
return self.render_to_response({})