I'm new to django. I've tried the tutorial so many times. I now have started my own project until I am faced with NoReverseMatch ... and keyword arguments '{}' not found. 0 pattern(s) tried: []
my template section_list.html
{% for section in section_name %}
<a href='{% url 'employee_listings' hsection section %}' >
{{ section }}
</br>
{% endfor %}
urls.py
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^letters/(?P<employee_id>\d+)$', views.letters, name='letters'),
url(r'(?P<word>\d+)/$', views.headsection_listings, name='headsection_listings'),
url(r'(?P<hsection>\w+)$', views.section_listings, name='section_listings'),
url(r'(?P<hsection>\w+)/(?P<section>\w+)/$', views.employee_listings, name='employee_listings'),
)
views.py
def employee_listings(request, hsection, section):
#import pdb; pdb.set_trace()
employee_list = Employee.objects.all()
employee_id = [p.emp_id for p in employee_list if p.section.section_name == section]
employee_name = [p.emp_first_name +' ' + p.emp_last_name for p in employee_list if p.section.section_name == section]
# import pdb; pdb.set_trace()
context = {'employee_name':employee_name, 'section':section, 'employee_id':employee_id}
return render(request, 'kapra/employee_list.html', context)
def section_listings(request, hsection):
section_list = Section.objects.all()
# import pdb; pdb.set_trace()
section_name = [p.section_name for p in section_list if p.headsection.head_section_name == hsection]
context = {'section_name':section_name, 'hsection':hsection}
return render(request, 'kapra/section_list.html', context)
Browser Output: NoReverseMatch at /kapra/Administration
Reverse for 'section_listings' with arguments '(u'Administration', u'Employee Admin')' and keyword arguments '{}' not found. 0 pattern(s) tried: []
.... Reverse for 'section_listings' with arguments '(u'Administration', u'Employee Admin')' and keyword arguments '{}' not found. 0 pattern(s) tried:[]
django_version 1.6.11 if I don't use {% url %} and use {/kapra/...} format it works.