@list_route(methods=['GET', 'POST', 'PUT', ...])
def foo(self, request, *args, **kwargs):
if request.method == 'GET':
# do something
# get
elif request.method == 'POST':
...
This was what I do always.
I think it is not a good idea that two or more different methods are in one
function.
So I tried below...
@list_route(methods=['GET'])
def foo(self, request, *args, **kwargs):
# do something
# get
@list_route(methods=['POST'])
def foo(self, request, *args, **kwargs):
# do something
# post
As I expected, POST override GET method.
Is there better way to do this or should I keep go what I did?
--
You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.