mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 02:49:15 +02:00
Added actions and tasks to purge domains and actors
This commit is contained in:
parent
833daa242c
commit
233ac870be
10 changed files with 251 additions and 14 deletions
14
api/funkwhale_api/common/decorators.py
Normal file
14
api/funkwhale_api/common/decorators.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
from rest_framework import response
|
||||
from rest_framework.decorators import list_route
|
||||
|
||||
|
||||
def action_route(serializer_class):
|
||||
@list_route(methods=["post"])
|
||||
def action(self, request, *args, **kwargs):
|
||||
queryset = self.get_queryset()
|
||||
serializer = serializer_class(request.data, queryset=queryset)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
result = serializer.save()
|
||||
return response.Response(result, status=200)
|
||||
|
||||
return action
|
Loading…
Add table
Add a link
Reference in a new issue