diff options
| author | Tom Christie | 2014-11-28 15:55:02 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-11-28 15:55:02 +0000 |
| commit | 08c727add37790b5a556db3fff762f4a27a5c660 (patch) | |
| tree | 2845ea324ac0adf914421a289a5272d6c0d2d74a /rest_framework | |
| parent | 3a5b3772fefc3c2f2c0899947cbc07bfe6e6b5d2 (diff) | |
| download | django-rest-framework-08c727add37790b5a556db3fff762f4a27a5c660.tar.bz2 | |
@api_view defaults to allowing GET
Diffstat (limited to 'rest_framework')
| -rw-r--r-- | rest_framework/decorators.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/rest_framework/decorators.py b/rest_framework/decorators.py index d28d6e22..325435b3 100644 --- a/rest_framework/decorators.py +++ b/rest_framework/decorators.py @@ -12,12 +12,14 @@ from rest_framework.views import APIView import types -def api_view(http_method_names): +def api_view(http_method_names=None): """ Decorator that converts a function-based view into an APIView subclass. Takes a list of allowed methods for the view as an argument. """ + if http_method_names is None: + http_method_names = ['GET'] def decorator(func): |
