Add open-api and scorecard view routes
diff --git a/scorecardapp/urls.py b/scorecardapp/urls.py
index e86b6f8..a0ac182 100644
--- a/scorecardapp/urls.py
+++ b/scorecardapp/urls.py
@@ -22,7 +22,9 @@
from datetime import datetime
from django.urls import path, include
from django.contrib import admin
+from rest_framework.schemas import get_schema_view
from django.contrib.auth.views import LoginView, LogoutView
+from django.views.generic.base import TemplateView
from rest_framework import routers
from app import forms, views
from api import views as apiViews
@@ -31,6 +33,7 @@
router = routers.DefaultRouter()
router.register(r'users', apiViews.UserViewSet)
router.register(r'groups', apiViews.GroupViewSet)
+router.register(r'scorecard', apiViews.ScorecardViewSet, basename='scorecard')
urlpatterns = [
@@ -52,6 +55,19 @@
path('logout/', LogoutView.as_view(next_page='/'), name='logout'),
path('admin/', admin.site.urls),
+ path('openapi', get_schema_view(
+ title="Your Project",
+ description="API for all things …",
+ version="1.0.0"
+ ), name='openapi-schema'),
+
+ # Route TemplateView to serve Swagger UI template.
+ # * Provide `extra_context` with view name of `SchemaView`.
+ path('swagger-ui/', TemplateView.as_view(
+ template_name='swagger-ui.html',
+ extra_context={'schema_url':'openapi-schema'}
+ ), name='swagger-ui'),
+
# API Views
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.