From 92cb161aeffb60723e17a5c2a87ad6492055286c Mon Sep 17 00:00:00 2001 From: p0lygun Date: Mon, 24 Jul 2023 00:36:46 +0530 Subject: [PATCH] feat(core): add base api url --- bfportal/bfportal/urls.py | 68 ++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/bfportal/bfportal/urls.py b/bfportal/bfportal/urls.py index a122f33..691dc10 100644 --- a/bfportal/bfportal/urls.py +++ b/bfportal/bfportal/urls.py @@ -22,41 +22,50 @@ path("admin/", include(wagtailadmin_urls)), path("documents/", include(wagtaildocs_urls)), # allow only social login :) - path("password/change/", RedirectView.as_view(url="/")), - path("password/set/", RedirectView.as_view(url="/")), - path("password/reset/", RedirectView.as_view(url="/")), - path("password/reset/done/", RedirectView.as_view(url="/")), - re_path( - "^password/reset/key/(?P[0-9A-Za-z]+)-(?P.+)/$", - RedirectView.as_view(url="/"), - ), - path("password/reset/key/done/", RedirectView.as_view(url="/")), - path("email/", RedirectView.as_view(url="/")), - path("confirm-email/", RedirectView.as_view(url="/")), - re_path("^confirm-email/(?P[-:\\w]+)/$", RedirectView.as_view(url="/")), - path("signup/", RedirectView.as_view(url="/")), + *[ + path("password/change/", RedirectView.as_view(url="/")), + path("password/set/", RedirectView.as_view(url="/")), + path("password/reset/", RedirectView.as_view(url="/")), + path("password/reset/done/", RedirectView.as_view(url="/")), + re_path( + "^password/reset/key/(?P[0-9A-Za-z]+)-(?P.+)/$", + RedirectView.as_view(url="/"), + ), + path("password/reset/key/done/", RedirectView.as_view(url="/")), + path("email/", RedirectView.as_view(url="/")), + path("confirm-email/", RedirectView.as_view(url="/")), + re_path("^confirm-email/(?P[-:\\w]+)/$", RedirectView.as_view(url="/")), + path("signup/", RedirectView.as_view(url="/")), + ], # go straight to discord login - path("login/", RedirectView.as_view(url="/discord/login/?process=login")), - path("", include("allauth.urls")), - path( - "api/categories/", - CategoriesAutocomplete.as_view(), - name="category-autocomplete", - ), - path("api/tags/", TagsAutocomplete.as_view(), name="tags-autocomplete"), - re_path(r"^api/report/(\d+)/$", report_experience, name="report-experience"), - re_path( - r"^api/like/(\d+)/$", - handle_like_request, - name="add_like_to_experience_page", - ), - path("api/", api_router.urls), + *[ + path("login/", RedirectView.as_view(url="/discord/login/?process=login")), + path("", include("allauth.urls")), + ], + # api urls + *[ + path( + "api/categories/", + CategoriesAutocomplete.as_view(), + name="category-autocomplete", + ), + path("api/tags/", TagsAutocomplete.as_view(), name="tags-autocomplete"), + re_path(r"^api/report/(\d+)/$", report_experience, name="report-experience"), + re_path( + r"^api/like/(\d+)/$", + handle_like_request, + name="add_like_to_experience_page", + ), + path("api/", api_router.urls), + re_path( + "^api/$", TemplateView.as_view(template_name="coming_soon.html") + ), # todo: add correct api docs + ], re_path(r"^ajax_select/", include(ajax_select_urls)), path("markdownx/", include("markdownx.urls")), path("events/", events_view, name="events-view"), ] - if settings.DEBUG: from django.conf.urls.static import static from django.contrib.staticfiles.urls import staticfiles_urlpatterns @@ -69,7 +78,6 @@ urlpatterns += staticfiles_urlpatterns() urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) - urlpatterns = urlpatterns + [ # For anything not caught by a more specific rule above, hand over to # Wagtail's page serving mechanism. This should be the last pattern in