|
@@ -4,8 +4,10 @@ from django.shortcuts import render
|
|
|
from rest_framework import status
|
|
|
from rest_framework.response import Response
|
|
|
from rest_framework.views import APIView
|
|
|
+from rest_framework.viewsets import ModelViewSet
|
|
|
|
|
|
from workreport.models import DailyReport
|
|
|
+from workreport.serializer import DailyReportSerializer
|
|
|
|
|
|
|
|
|
class DailyReportViews(APIView):
|
|
@@ -18,3 +20,8 @@ class DailyReportViews(APIView):
|
|
|
report = DailyReport(title=data['title'], content=data['content'], create_by_id=data['create_by_id'])
|
|
|
report.save()
|
|
|
return Response(status=status.HTTP_201_CREATED)
|
|
|
+
|
|
|
+
|
|
|
+class ReportViews(ModelViewSet):
|
|
|
+ queryset = DailyReport.objects.all()
|
|
|
+ serializer_class = DailyReportSerializer
|