Exemple #1
0
 def update(self, request, *args, **kwargs):
     permission_required(request.user, ['oa.change_workreport'])
     work_report = WorkReport.objects.get(pk=kwargs['pk'])
     serializer = WorkReportSerializer(work_report, data=request.data, partial=True)
     if serializer.is_valid():
         serializer.save()
         add_log(request.user, 2, '修改工作报告 %s,%s' % (work_report.name, queryset_str(request.data)))
         return success_response(serializer.data)
     else:
         return error_response(1, serializer.errors)
Exemple #2
0
 def update(self, request, *args, **kwargs):
     permission_required(request.user, ['oa.change_emailtemplate'])
     email_template = EmailTemplate.objects.get(pk=kwargs['pk'])
     serializer = EmailTemplateSerializer(email_template, data=request.data, partial=True)
     if serializer.is_valid():
         serializer.save()
         add_log(request.user, 2, '修改邮件模板 %s,%s' % (email_template.name, queryset_str(request.data)))
         return success_response(serializer.data)
     else:
         return error_response(1, serializer.errors)
Exemple #3
0
 def update(self, request, *args, **kwargs):
     permission_required(request.user, ['oa.change_notification'])
     notification = Notification.objects.get(pk=kwargs['pk'])
     serializer = NotificationSerializer(notification, data=request.data, partial=True)
     if serializer.is_valid():
         serializer.save()
         add_log(request.user, 2, '修改通知 %s,%s' % (notification.name, queryset_str(request.data)))
         return success_response(serializer.data)
     else:
         return error_response(1, serializer.errors)
Exemple #4
0
 def update(self, request, *args, **kwargs):
     permission_required(request.user, ['school.change_school'])
     school = School.objects.get(pk=kwargs['pk'])
     serializer = SchoolSerializer(school, data=request.data, partial=True)
     if serializer.is_valid():
         serializer.save()
         add_log(request.user, 2,
                 '修改学校 %s信息,%s' % (school.name, queryset_str(request.data)))
         return success_response(serializer.data)
     else:
         return error_response(1, serializer.errors)
Exemple #5
0
 def update(self, request, *args, **kwargs):
     permission_required(request.user, ['oa.change_sms'])
     sms = SMS.objects.get(pk=kwargs['pk'])
     serializer = SMSSerializer(sms, data=request.data, partial=True)
     if serializer.is_valid():
         serializer.save()
         add_log(request.user, 2,
                 '修改短信 %s,%s' % (sms.name, queryset_str(request.data)))
         return success_response(serializer.data)
     else:
         return error_response(1, serializer.errors)