urls.py 1.0 KB

1234567891011121314151617181920212223242526272829
  1. from django.urls import include, path
  2. from rest_framework_nested import routers
  3. from apps.alerts.views import ProjectAlertViewSet
  4. from apps.environments.views import EnvironmentProjectViewSet
  5. from apps.releases.views import ReleaseViewSet
  6. from .views import ProjectKeyViewSet, ProjectViewSet
  7. router = routers.SimpleRouter()
  8. router.register(r"projects", ProjectViewSet)
  9. projects_router = routers.NestedSimpleRouter(router, r"projects", lookup="project")
  10. projects_router.register(r"keys", ProjectKeyViewSet, basename="project-keys")
  11. projects_router.register(r"alerts", ProjectAlertViewSet, basename="project-alerts")
  12. projects_router.register(
  13. r"environments", EnvironmentProjectViewSet, basename="project-environments"
  14. )
  15. projects_router.register(r"releases", ReleaseViewSet, basename="project-releases")
  16. releases_router = routers.NestedSimpleRouter(
  17. projects_router, r"releases", lookup="release"
  18. )
  19. urlpatterns = [
  20. path("", include(router.urls)),
  21. path("", include(projects_router.urls)),
  22. path("", include(releases_router.urls)),
  23. ]