views.py 603 B

1234567891011121314151617181920212223
  1. from rest_framework import viewsets
  2. from .models import Project
  3. from .serializers.serializers import BaseProjectSerializer, ProjectSerializer
  4. class BaseProjectViewSet(viewsets.GenericViewSet):
  5. serializer_class = BaseProjectSerializer
  6. queryset = Project.undeleted_objects.none()
  7. lookup_field = "slug"
  8. class ProjectViewSet(BaseProjectViewSet):
  9. """
  10. /api/0/projects/
  11. Includes organization
  12. Detail view includes teams
  13. """
  14. serializer_class = ProjectSerializer
  15. lookup_field = "pk"
  16. lookup_value_regex = r"(?P<organization_slug>[^/.]+)/(?P<project_slug>[-\w]+)"