title: Category matching query does not exist Error
body: <p>I want to post an url and save to Link model. But I got this error:</p>
  
  <pre><code>Category matching query does not exist
  </code></pre>
  
  <p>my views.py</p>
  
  <pre><code>def category_detail(request, category_name):
      if request.POST:
          form = CreateLinkForm(request.POST)
          user = request.user
          if form.is_valid():
              link = form.save(commit=False)
              link.user = user 
              link.category = Category.objects.get(name=category_name)
              link.save()
          return HttpResponseRedirect(reverse('category_detail', args=[category_name]))
      else:
          form = CreateLinkForm()
      links = Link.objects.filter(category__name=category_name)
      return render_to_response("category_detail.html", {"links":links, "form":form, "category_name":category_name}, context_instance=RequestContext(request))
  </code></pre>
  
  <p>When I query at terminal python manage.py shell I get this :</p>
  
  <pre><code>&gt;&gt;&gt; from link.models import Category
  &gt;&gt;&gt; Category.objects.all()
  [&lt;Category: &lt;django.db.models.fields.related.ManyRelatedManager object at 0x22dbfd0&gt; Programlama&gt;, &lt;Category: &lt;django.db.models.fields.related.ManyRelatedManager object at 0x22de110&gt; Foto&gt;, &lt;Category: &lt;django.db.models.fields.related.ManyRelatedManager object at 0x22dbfd0&gt; Sanat&gt;]
  &gt;&gt;&gt; Category.objects.get(name="Foto")
  &lt;Category: &lt;django.db.models.fields.related.ManyRelatedManager object at 0x22dbed0&gt; Foto&gt;
  </code></pre>
  
  <p>Link model:</p>
  
  <pre><code>class Link(models.Model):
      user = models.ForeignKey(User)
      posted_at = models.DateTimeField(auto_now_add=True)
      url = models.URLField()
      title = models.CharField(max_length=255, null=True, blank=True)
      category = models.ForeignKey(Category)
  
      def __unicode__(self):
          return "%s %s %s" %(self.url, self.title, self.category)
  </code></pre>
  
  <p>CreateLinkForm:</p>
  
  <pre><code>class CreateLinkForm(ModelForm):
      class Meta:
          model = Link 
          exclude = ["user", "posted_at", "category"]
  </code></pre>
  
  <p>So what is my wrong ? Why I got this error <code>Category matching query does not exist</code></p>