urls.py 798 B

1234567891011121314151617181920212223
  1. from django.urls import include, path
  2. from rest_framework_nested import routers
  3. from glitchtip.routers import BulkSimpleRouter
  4. from user_reports.views import UserReportViewSet
  5. from .views import CommentViewSet, EventViewSet, IssueViewSet
  6. router = BulkSimpleRouter()
  7. router.register(r"issues", IssueViewSet)
  8. issues_router = routers.NestedSimpleRouter(router, r"issues", lookup="issue")
  9. issues_router.register(r"events", EventViewSet, basename="issue-events")
  10. issues_router.register(
  11. r"user-reports", UserReportViewSet, basename="issue-user-reports"
  12. )
  13. issues_router.register(r"comments", CommentViewSet, basename="issue-comments")
  14. # The API URLs are now determined automatically by the router.
  15. urlpatterns = [
  16. path("", include(router.urls)),
  17. path("", include(issues_router.urls)),
  18. ]