views.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from .models import KeywordMission, DateMission, TimeMission, PageMission
  2. from rest_framework.parsers import JSONParser
  3. from rest_framework import viewsets
  4. from .serializers import UserSerializer, KeywordMissionSerializer, DateMissionSerializer, TimeMissionSerializer, \
  5. PageMissionSerializer
  6. from django.contrib.auth.models import User
  7. class KeywordMissionViewSet(viewsets.ModelViewSet):
  8. """
  9. 允许用户查看或编辑的API路径。
  10. """
  11. queryset = KeywordMission.objects.all()
  12. serializer_class = KeywordMissionSerializer
  13. class UserViewSet(viewsets.ModelViewSet):
  14. """
  15. 允许用户查看或编辑的API路径。
  16. """
  17. queryset = User.objects.all()
  18. serializer_class = UserSerializer
  19. class DateMissionViewSet(viewsets.ModelViewSet):
  20. """
  21. 允许用户查看或编辑的API路径。
  22. """
  23. queryset = DateMission.objects.all()
  24. serializer_class = DateMissionSerializer
  25. class TimeMissionViewSet(viewsets.ModelViewSet):
  26. """
  27. 允许用户查看或编辑的API路径。
  28. """
  29. queryset = TimeMission.objects.all()
  30. serializer_class = TimeMissionSerializer
  31. class PageMissionViewSet(viewsets.ModelViewSet):
  32. """
  33. 允许用户查看或编辑的API路径。
  34. """
  35. queryset = PageMission.objects.all()
  36. serializer_class = PageMissionSerializer