bornhack-website/src/bornhack/urls.py

154 lines
5.7 KiB
Python
Raw Normal View History

2019-03-26 08:53:06 +00:00
from allauth.account.views import LoginView, LogoutView
from bar.views import MenuView
from camps.views import CampDetailView, CampListView, CampRedirectView
from django.conf import settings
2019-03-26 08:53:06 +00:00
from django.conf.urls import include
2015-10-03 01:07:05 +00:00
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from django.urls import path
2019-03-11 20:27:33 +00:00
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import TemplateView
2018-08-20 13:13:51 +00:00
from feedback.views import FeedbackCreate
from graphene_django.views import GraphQLView
from info.views import CampInfoView
from people.views import PeopleView
from sponsors.views import SponsorsView
from villages.views import (
VillageCreateView,
VillageDeleteView,
VillageDetailView,
VillageListView,
VillageUpdateView,
)
2015-10-03 01:07:05 +00:00
2017-12-30 23:16:07 +00:00
# require 2fa token entry (if enabled on admin account) when logging into /admin by using allauth login form
admin.site.login = login_required(admin.site.login)
2015-10-03 01:07:05 +00:00
urlpatterns = [
2019-06-16 12:32:24 +00:00
path("profile/", include("allauth.urls")),
path("profile/", include("allauth_2fa.urls")),
path("profile/", include("profiles.urls", namespace="profiles")),
path("tickets/", include("tickets.urls", namespace="tickets")),
path("shop/", include("shop.urls", namespace="shop")),
path("news/", include("news.urls", namespace="news")),
path(
2019-06-16 12:32:24 +00:00
"contact/", TemplateView.as_view(template_name="contact.html"), name="contact"
),
2019-06-16 12:32:24 +00:00
path("conduct/", TemplateView.as_view(template_name="coc.html"), name="conduct"),
path("login/", LoginView.as_view(), name="account_login"),
path("logout/", LogoutView.as_view(), name="account_logout"),
path(
2019-06-16 12:32:24 +00:00
"privacy-policy/",
TemplateView.as_view(template_name="legal/privacy_policy.html"),
name="privacy-policy",
2016-08-08 18:05:21 +00:00
),
path(
2019-06-16 12:32:24 +00:00
"general-terms-and-conditions/",
TemplateView.as_view(template_name="legal/general_terms_and_conditions.html"),
name="general-terms",
2016-08-08 18:05:21 +00:00
),
2019-06-16 12:32:24 +00:00
path("admin/", admin.site.urls),
2019-03-11 20:27:33 +00:00
# We don't need CSRF checks for the API
2019-06-16 12:32:24 +00:00
path("api/", csrf_exempt(GraphQLView.as_view(graphiql=True))),
path("camps/", CampListView.as_view(), name="camp_list"),
path("token/", include("tokens.urls", namespace="tokens")),
2017-02-19 20:20:19 +00:00
# camp redirect views here
path(
2019-06-16 12:32:24 +00:00
"",
2017-02-19 20:20:19 +00:00
CampRedirectView.as_view(),
2019-06-16 12:32:24 +00:00
kwargs={"page": "camp_detail"},
name="camp_detail_redirect",
2017-02-19 20:20:19 +00:00
),
path(
2019-06-16 12:32:24 +00:00
"program/",
2017-02-19 20:20:19 +00:00
CampRedirectView.as_view(),
kwargs={"page": "program:schedule_index"},
2019-06-16 12:32:24 +00:00
name="schedule_index_redirect",
2017-02-19 20:20:19 +00:00
),
path(
2019-06-16 12:32:24 +00:00
"info/",
2017-02-19 20:20:19 +00:00
CampRedirectView.as_view(),
2019-06-16 12:32:24 +00:00
kwargs={"page": "info"},
name="info_redirect",
2017-02-19 20:20:19 +00:00
),
path(
2019-06-16 12:32:24 +00:00
"sponsors/",
2017-02-19 20:20:19 +00:00
CampRedirectView.as_view(),
2019-06-16 12:32:24 +00:00
kwargs={"page": "sponsors"},
name="sponsors_redirect",
2017-02-19 20:20:19 +00:00
),
path(
2019-06-16 12:32:24 +00:00
"villages/",
2017-02-19 20:20:19 +00:00
CampRedirectView.as_view(),
2019-06-16 12:32:24 +00:00
kwargs={"page": "village_list"},
name="village_list_redirect",
2017-07-11 20:50:31 +00:00
),
path(
"wishlist/",
CampRedirectView.as_view(),
kwargs={"page": "wishlist:list"},
name="wish_list_redirect",
),
path(
"backoffice/",
CampRedirectView.as_view(),
kwargs={"page": "backoffice:index"},
name="backoffice_redirect",
),
2019-06-16 12:32:24 +00:00
path("people/", PeopleView.as_view(), name="people"),
# camp specific urls below here
path(
2019-06-16 12:32:24 +00:00
"<slug:camp_slug>/",
include(
[
path("", CampDetailView.as_view(), name="camp_detail"),
path("info/", CampInfoView.as_view(), name="info"),
path("program/", include("program.urls", namespace="program")),
path("sponsors/", SponsorsView.as_view(), name="sponsors"),
path("bar/menu/", MenuView.as_view(), name="menu"),
path(
"villages/",
include(
[
path("", VillageListView.as_view(), name="village_list"),
path(
"create/",
VillageCreateView.as_view(),
name="village_create",
),
path(
"<slug:slug>/delete/",
VillageDeleteView.as_view(),
name="village_delete",
),
path(
"<slug:slug>/edit/",
VillageUpdateView.as_view(),
name="village_update",
),
# this has to be the last url in the list
path(
"<slug:slug>/",
VillageDetailView.as_view(),
name="village_detail",
),
]
2016-12-28 23:15:13 +00:00
),
2019-06-16 12:32:24 +00:00
),
path("teams/", include("teams.urls", namespace="teams")),
path("rideshare/", include("rideshare.urls", namespace="rideshare")),
path("backoffice/", include("backoffice.urls", namespace="backoffice")),
path("feedback/", FeedbackCreate.as_view(), name="feedback"),
path("economy/", include("economy.urls", namespace="economy")),
path("wishlist/", include("wishlist.urls", namespace="wishlist")),
path("facilities/", include("facilities.urls", namespace="facilities")),
2019-06-16 12:32:24 +00:00
]
),
),
2015-10-03 01:07:05 +00:00
]
if settings.DEBUG:
import debug_toolbar
2019-06-16 12:32:24 +00:00
urlpatterns = [path("__debug__/", include(debug_toolbar.urls))] + urlpatterns