urls.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. from django.urls import include, path
  2. from rest_framework_nested import routers
  3. from alerts.views import ProjectAlertViewSet
  4. from environments.views import EnvironmentProjectViewSet
  5. from issues.views import EventViewSet, IssueViewSet
  6. from releases.views import ReleaseFileViewSet, ReleaseViewSet
  7. from .views import ProjectKeyViewSet, ProjectTeamViewSet, ProjectViewSet
  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. ]