Reputation: 3600
I have the following django 1.9 endpoint:
url(r'^(?P<pk>\d+)/members/(?P<status>active|deactivated)?$',
gym.GymUserListView.as_view(),
name='user-list')
Using the above, a valid url would be like like /1/members/active
or /1/members/deactivated
I am trying use the url
in one of my templates like:
<button type="button" class="btn btn-outline-warning">
<a href="{% url 'user-list' pk=gym.id status='deactivated' %}"/>View Inactive</a>
</button>
This throws the following error:
django.core.urlresolvers.NoReverseMatch: Reverse for 'user-list' with arguments '()' and keyword arguments '{'pk': 1, 'status': 'deactivated'}' not found.
0 pattern(s) tried: [ ]
What could be wrong?
Upvotes: 0
Views: 584
Reputation: 308779
It looks like you have forgotten to include the namespace. The URL tag should be something like:
{% url 'users:user-list' pk=gym.id status='deactivated' %}
Upvotes: 1
Reputation: 8103
This could be a few things.
{% url 'myapp:user-list' pk=gym.id status='deactivated' %}
urls.py
is for this case in your INSTALLED_APPS
? Upvotes: 2