title: Django, url does not match
body: <p>This may be a duplicate question but I can't find any answer here on SO.
  I'm trying to write a method able to take two different models. I have a Post model and a Comment model, and I want the vote_up method to handle voting for both of these.</p>
  
  <p>views.py</p>
  
  <pre><code>def vote_up(request, obj): #portotype not working atm...
      if isinstance(obj, Post):
          o = Post.objects.get(id=obj.id)
      elif isinstance(obj, Comment):
          o = Comment.objects.get(id=obj.id)
      else:           
          return HttpResponseRedirect(request.META.get('HTTP_REFERER')) #add 'something went wrong' message
      o.votes += 1    
      o.save()    
      return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
  </code></pre>
  
  <p>urls.py</p>
  
  <pre><code>urlpatterns = patterns('',
      url(r'^vote_up/(?P&lt;obj&gt;\d+)/$', 'post.views.vote_up'),
      url(r'^post_vote_down/(?P&lt;post_id&gt;\d+)/$', 'post.views.post_vote_down'), # works fine no instance check here, using separate methods for Post/Comment
      url(r'^comment_vote_down/(?P&lt;comment_id&gt;\d+)/$', 'post.views.comment_vote_down'),
  ) 
  </code></pre>
  
  <p>The errors i get is listing my existing urls and:
  The current URL, post/vote_up/Post object, didn't match any of these.
  or
  The current URL, post/vote_up/Comment object, didn't match any of these.</p>
  
  <p>I'm guessing \d+ is the villain but can't seem to find the right syntax.</p>