浏览代码

add DailyReportViews Post api

DYaiu 4 年之前
父节点
当前提交
3ac0e5184c
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      workreport/views.py

+ 6 - 0
workreport/views.py

@@ -12,3 +12,9 @@ class DailyReportViews(APIView):
     def get(self, request):
         data = DailyReport.objects.values('title', 'content', 'create_at', 'create_by', 'id')
         return Response(data=data, status=status.HTTP_200_OK)
+
+    def post(self, request):
+        data = request.data
+        report = DailyReport(title=data['title'], content=data['content'], create_by_id=data['create_by_id'])
+        report.save()
+        return Response(status=status.HTTP_201_CREATED)