From 596bf5c0a856fa836e629c25fbb78967a21deddf Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 4 Aug 2023 14:08:16 -0500 Subject: [PATCH] Registering routers if v2 is on. --- server/urls.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/server/urls.py b/server/urls.py index 119147a6..b5fb9b0c 100644 --- a/server/urls.py +++ b/server/urls.py @@ -51,14 +51,15 @@ router_v2 = routers.DefaultRouter() -router_v2.register(r'items',views_v2.ItemViewSet) -router_v2.register(r'itemsets',views_v2.ItemSetViewSet) -router_v2.register(r'documents',views_v2.DocumentViewSet) -router_v2.register(r'licenses',views_v2.LicenseViewSet) -router_v2.register(r'publishers',views_v2.PublisherViewSet) -router_v2.register(r'weapons',views_v2.WeaponViewSet) -router_v2.register(r'armor',views_v2.ArmorViewSet) -router_v2.register(r'rulesets',views_v2.RulesetViewSet) +if settings.V2_ENABLED: + router_v2.register(r'items',views_v2.ItemViewSet) + router_v2.register(r'itemsets',views_v2.ItemSetViewSet) + router_v2.register(r'documents',views_v2.DocumentViewSet) + router_v2.register(r'licenses',views_v2.LicenseViewSet) + router_v2.register(r'publishers',views_v2.PublisherViewSet) + router_v2.register(r'weapons',views_v2.WeaponViewSet) + router_v2.register(r'armor',views_v2.ArmorViewSet) + router_v2.register(r'rulesets',views_v2.RulesetViewSet) # Wire up our API using automatic URL routing. # Additionally, we include login URLs for the browsable API.