urls.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. from django.urls import path, include
  2. from rest_framework_nested import routers
  3. from issues.views import IssueViewSet
  4. from teams.views import NestedTeamViewSet
  5. from environments.views import EnvironmentViewSet
  6. from releases.views import ReleaseViewSet
  7. from performance.views import TransactionViewSet
  8. from glitchtip.uptime.views import MonitorViewSet, MonitorCheckViewSet
  9. from glitchtip.routers import BulkSimpleRouter
  10. from .views import (
  11. OrganizationViewSet,
  12. OrganizationUserViewSet,
  13. OrganizationMemberViewSet,
  14. OrganizationProjectsViewSet,
  15. AcceptInviteView,
  16. )
  17. router = BulkSimpleRouter()
  18. router.register(r"organizations", OrganizationViewSet)
  19. organizations_router = routers.NestedSimpleRouter(
  20. router, r"organizations", lookup="organization"
  21. )
  22. organizations_router.register(r"issues", IssueViewSet, basename="organization-issues")
  23. organizations_router.register(
  24. r"teams", NestedTeamViewSet, basename="organization-teams"
  25. )
  26. organizations_router.register(
  27. r"members", OrganizationMemberViewSet, basename="organization-members"
  28. )
  29. organizations_router.register(
  30. r"users", OrganizationUserViewSet, basename="organization-users"
  31. )
  32. organizations_router.register(
  33. r"projects", OrganizationProjectsViewSet, basename="organization-projects"
  34. )
  35. organizations_router.register(
  36. r"environments", EnvironmentViewSet, basename="organization-environments"
  37. )
  38. organizations_router.register(
  39. r"releases", ReleaseViewSet, basename="organization-releases"
  40. )
  41. organizations_router.register(
  42. r"transactions", TransactionViewSet, basename="organization-transactions"
  43. )
  44. organizations_router.register(
  45. r"monitors", MonitorViewSet, basename="organization-monitors"
  46. )
  47. organizations_monitors_router = routers.NestedSimpleRouter(
  48. organizations_router, r"monitors", lookup="monitor"
  49. )
  50. organizations_monitors_router.register(
  51. r"checks", MonitorCheckViewSet, basename="organization-monitor-checks"
  52. )
  53. urlpatterns = [
  54. path("", include(router.urls)),
  55. path("", include(organizations_router.urls)),
  56. path("", include(organizations_monitors_router.urls)),
  57. path(
  58. "accept/<int:org_user_id>/<token>/",
  59. AcceptInviteView.as_view(),
  60. name="accept-invite",
  61. ),
  62. ]