title: How to create query filter based on for-loop button clicked
body: <p>I'm creating a sample company web database, mainly with employee records and stuff. On one of the page, I want to display all the employees based on their department. </p>
  
  <p>On my models, the department is a CharField choices. I can display the list of these departments by creating a list comprehension in views.py then forloop buttons on the html page with an href tag to the department's page. Now on this where I'm having difficulties. Clearly each element of the for loop will just get redirected to the same page no matter which button was clicked. I've tried to create a query filter and pass the actual department's name and this will work. </p>
  
  <p>On my views i have this:</p>
  
  <pre><code>from django.shortcuts import render
  from .models import Staff
  
  def depts(request):
      deptList = Staff.department_list
      depts = [x[1] for x in deptList]
      return render(request, 'dsvstaff/depts.html',{'depts':depts})
  
  
  def theStaffs(request):
      staffs = Staff.objects.filter(department='?')
      return render(request, 'dsvstaff/theStaffs.html',{'staffs':staffs})
  </code></pre>
  
  <p>Then on my Department list page:</p>
  
  <pre><code>{% block content %}
  
  &lt;div class="container"&gt;
       {% for dept in depts %} 
  
  &lt;a class="btn btn-primary" href="{% url 'theStaffs' %}"&gt;{{ dept }}&lt;/a&gt;
  
        {% endfor %}
  
  &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p>This page is where I'm having difficulties:</p>
  
  <pre><code>{% block content %}
  
      {% for x in staffs %}
          {{ x.first_name }} {{ x.last_name }} - {{ x.postion }}
  
      {% endfor %}
  
  {% endblock %}
  </code></pre>
  
  <p>What I wanted is to pass the name of the department's name in the query filter based on the button clicked.</p>