title: Django 1.6: Matching query does not exist
body: <p>I'm trying to implement a dropdown form which filters objects depending on the selection from the dropdown. I don't have any issues doing that but it gives me an error when nothing is selected and clicked submit. I want it to not filter anything and just give the entire list of the objects but i get the following error <code>Specialization matching query does not exist</code> on line</p>
  
  <pre><code>spec = Specialization.objects.get(name = s_name)
  </code></pre>
  
  <p>Here is the template where I've the form</p>
  
  <pre><code>&lt;form action="/doclistings/" method="GET" &gt;
          &lt;select class="form-control" id="selection" name="selection"&gt;
            &lt;option&gt;&lt;b&gt;Choose a Speciality...&lt;/b&gt;&lt;/option&gt;
            {% for value, text in form.selection.field.choices %}
              &lt;option name="choicemade" value="{{ value }}"&gt;{{ text }}&lt;/option&gt;
            {% endfor %}
            &lt;!-- {% csrf_token %} --&gt;
          &lt;/select&gt;
  
          &lt;span class="input-group-btn"&gt;
            &lt;button class="btn btn-primary" type="submit"  name="submit" id="ss-submit"&gt;Find Doctors&lt;/button&gt;
          &lt;/span&gt;
        &lt;/form&gt;
  </code></pre>
  
  <p>here is the form</p>
  
  <pre><code>MY_CHOICES = (
      ('Dermatologist', 'Dermatologist'),
      ('Dentist', 'Dentist'),
      ('Orthopedist', 'Orthopedist'),
      ('Pediatrician', 'Pediatrician'),
  )
  
  class DropdownSelectionForm(forms.Form):
      selection = forms.ChoiceField(choices=MY_CHOICES, widget = forms.Select, required = False)
      genderselect = forms.ChoiceField(choices=GENDER_CHOICES, widget= forms.Select, required = False)
  </code></pre>
  
  <p>here is the view that's rendering the dropdown form</p>
  
  <pre><code>def index(request):
      d = getVariables(request,dictionary={'page_name': "Home"})
      if request.method == "POST":
          form = DropdownSelectionForm(request.POST)
  
          if form.is_valid():
              selection = form.cleaned_data['selection']
  
              return HttpResponseRedirect('/doclistings')
      else:
          form = DropdownSelectionForm()
  
      return render(request, 'meddy1/index.html', {'form': form})
  </code></pre>
  
  <p>Here is the view that's rendering the objects based on the selection  </p>
  
  <pre><code>def doclistings(request):
      d = getVariables(request)
      if request.method == "GET":
  
          s_name = request.GET['selection']
  
          if s_name == "":
              doctors = Doctor.objects.all().order_by('-netlikes')
  
          else:
              spec = Specialization.objects.get(name = s_name)
              doctors = Doctor.objects.filter(specialization = spec).order_by('-netlikes')
  
      else:
          return HttpResponseRedirect('/doclistings')
  
  
      d['doctors'] = doctors
      return render_to_response('meddy1/doclistings.html',d)
  </code></pre>