This commit is contained in:
shilixia 2021-03-17 14:40:17 +08:00
commit 8d8d6f472d
1 changed files with 10 additions and 0 deletions

View File

@ -126,6 +126,16 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
instance.note = request.data.get('note', None)
instance.save()
return Response(status=status.HTTP_200_OK)
@action(methods=['post'], detail=True, perms_map = {'post':'record_up'})
def createself(self, request, *args, **kwargs):
contents = request.data['contents']
rlist = []
for i in contents:
data = {'content':Content.objects.get(pk=i), 'belong_dept':request.user.dept, 'is_self':True}
rlist.append(Record(**data))
Record.objects.bulk_create(rlist)
return Response(status=status.HTTP_200_OK)
@action(methods=['put'], detail=True, perms_map = {'post':'record_up'})
def up(self, request, *args, **kwargs):