Skip to content

Instantly share code, notes, and snippets.

@callmephilip
Created August 22, 2012 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save callmephilip/3430537 to your computer and use it in GitHub Desktop.
Save callmephilip/3430537 to your computer and use it in GitHub Desktop.
[Django] requiring a view to accept particular method(s)
from django.views.decorators.http import require_http_methods
@require_http_methods(["GET", "POST"])
def my_view(request):
# I can assume now that only GET or POST requests make it this far
# ...
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment