make trailing slashes optional in API
This commit is contained in:
parent
97a6d1321b
commit
f7a8c1fe57
|
@ -17,7 +17,15 @@ from django.urls import path, include
|
|||
from rest_framework import routers
|
||||
from apiv1 import views
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
|
||||
class OptionalTrailingSlashRouter(routers.DefaultRouter):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.trailing_slash = r'/?'
|
||||
|
||||
|
||||
router = OptionalTrailingSlashRouter()
|
||||
router.register(r'instances', views.InstanceViewSet)
|
||||
|
||||
urlpatterns = [
|
||||
|
|
Loading…
Reference in a new issue