Created
August 22, 2012 23:30
-
-
Save callmephilip/3430537 to your computer and use it in GitHub Desktop.
[Django] requiring a view to accept particular method(s)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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