Commit 0545077c authored by Jean Michel Rouly's avatar Jean Michel Rouly

Apply filter.

parent 4642124d
......@@ -50,7 +50,10 @@ def index(request, *args, **kwargs):
section = kwargs.get('section')
if section is not None:
pass
section = section.replace(" ", "")
section = section.upper()
questions = Question.objects.filter(section__iexact=section)
paginator = Paginator(questions, 10) # show 25 questions per page
......@@ -66,6 +69,7 @@ def index(request, *args, **kwargs):
questions = paginator.page(paginator.num_pages)
return render(request, 'index.html', {
'filter' : section,
'questions' : questions,
'page_range' : range(1, int(questions.paginator.num_pages)+1),
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment