title: Http verb decorator for Django?
body: <p>In ASP.NET MVC, you can use the AcceptVerbs attribute to correlate a view function with a verb:</p>
  
  <pre><code>public ActionResult Create()
  {
      // do get stuff
  } 
  
  [AcceptVerbs(HttpVerbs.Post)]
  public ActionResult Create(FormCollection collection)
  {
      // do post stuff
  }
  </code></pre>
  
  <p><a href="http://www.djangobook.com/en/2.0/chapter08/" rel="nofollow noreferrer">The Django Book</a> suggests something like this:</p>
  
  <pre><code>def method_splitter(request, *args, **kwargs):
      get_view = kwargs.pop('GET', None)
      post_view = kwargs.pop('POST', None)
      if request.method == 'GET' and get_view is not None:
          return get_view(request, *args, **kwargs)
      elif request.method == 'POST' and post_view is not None:
          return post_view(request, *args, **kwargs)
      raise Http404
  </code></pre>
  
  <p>urls.py:</p>
  
  <pre><code>urlpatterns = patterns('',
      # ...
      (r'^somepage/$', views.method_splitter, {'GET': views.some_page_get, 
          'POST': views.some_page_post}),
      # ...
  )
  </code></pre>
  
  <p>That seems a little ugly to me - is there a decorator that can associate an HTTP verb with a view, ASP.NET MVC-style, or another accepted way to do this?</p>