urls.py 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. from django.urls import path, include
  2. from rest_framework_nested import routers
  3. from issues.views import IssueViewSet, EventViewSet
  4. from alerts.views import ProjectAlertViewSet
  5. from releases.views import ReleaseViewSet, ReleaseFileViewSet
  6. from environments.views import EnvironmentProjectViewSet
  7. from .views import ProjectViewSet, ProjectKeyViewSet, ProjectTeamViewSet
  8. router = routers.SimpleRouter()
  9. router.register(r"projects", ProjectViewSet)
  10. projects_router = routers.NestedSimpleRouter(router, r"projects", lookup="project")
  11. projects_router.register(r"keys", ProjectKeyViewSet, basename="project-keys")
  12. projects_router.register(r"issues", IssueViewSet, basename="project-issues")
  13. projects_router.register(r"events", EventViewSet, basename="project-events")
  14. projects_router.register(r"alerts", ProjectAlertViewSet, basename="project-alerts")
  15. projects_router.register(r"teams", ProjectTeamViewSet, basename="project-teams")
  16. projects_router.register(
  17. r"environments", EnvironmentProjectViewSet, basename="project-environments"
  18. )
  19. projects_router.register(r"releases", ReleaseViewSet, basename="project-releases")
  20. releases_router = routers.NestedSimpleRouter(
  21. projects_router, r"releases", lookup="release"
  22. )
  23. releases_router.register(r"files", ReleaseFileViewSet, basename="files")
  24. urlpatterns = [
  25. path("", include(router.urls)),
  26. path("", include(projects_router.urls)),
  27. path("", include(releases_router.urls)),
  28. ]