I'm having some problem with my url in Django (1.9)
Tried many way to solve it, but still the same type of error
Reverse for 'elus' with arguments '()' and keyword arguments '{u'council': u'CFVU'}' not found. 1 pattern(s) tried: ['elus/(?P<council>[A-B]+)$']
The actual code is this :
View :
class RepresentativeView(ListView):
model = Representative
template_name= 'lea/elus.html'
context_object_name = 'represents'
def get_queryset(self, council):
return Representative.objects.filter(active=True).filter(council=council).order_by(order)
url :
url(r'^elus/(?P<council>[A-B]+)$', views.RepresentativeView.as_view(), name='elus'),
Template :
{% url 'elus' council='CFVU' %}
I've tried with **kwargs and other things. It work with **kwargs in another function with <pk> in url, and my query is based on the id. But here, with a string I can't find the solution.