fix
This commit is contained in:
@@ -43,6 +43,7 @@ urlpatterns = [
|
||||
path('pay/', party_views.PartyPaymentApiView.as_view()),
|
||||
path('statistics/', party_views.PartyStatisticsApiView.as_view()),
|
||||
path('bulk-delete/', party_views.DeleteMultiplePartyApiView.as_view()),
|
||||
path('<uuid:id>/change-confirmation/', party_views.ChangeConfirmationPartyApiView.as_view()),
|
||||
]
|
||||
)),
|
||||
]
|
||||
@@ -237,3 +237,25 @@ class DeleteMultiplePartyApiView(views.APIView):
|
||||
|
||||
deleted_count, _ = Party.objects.filter(id__in=ids).delete()
|
||||
return Response({"deleted": deleted_count}, status=200)
|
||||
|
||||
|
||||
class ChangeConfirmationPartyApiView(views.APIView):
|
||||
permission_classes = [HasRolePermission]
|
||||
|
||||
def post(self, request, id):
|
||||
party = get_object_or_404(Party, id=id)
|
||||
confirmation = request.data.get('confirmation', None)
|
||||
if not confirmation:
|
||||
return Response({
|
||||
'success': False, 'message': 'confirmation field is required'
|
||||
}, status=400)
|
||||
party.confirmation = confirmation
|
||||
party.save()
|
||||
return Response(
|
||||
{
|
||||
'success': True,
|
||||
'message': 'confirmation changed successfully',
|
||||
},
|
||||
status=200
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user