Files
TipPy/tipp/urls.py

33 lines
1.4 KiB
Python

from django.contrib.auth import views as auth_views
from django.urls import re_path
from django.conf.urls import include
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns = [
re_path(r'^$', views.home, name='home'),
re_path(r'^getSeason/(?P<ls>.*)/(?P<season>\d{4})$',
views.getSeason),
re_path(r'^update/(?P<ls>.*)/(?P<season>\d{4})/(?P<cur_md>\d{2})$',
views.update, name='update'),
re_path(r'^matchday/(?P<ls>.{3,})/(?P<season>\d{4})/(?P<matchday>\d{2})$',
views.matchday, name='matchday'),
re_path(r'^charts/(?P<ls>\w{3,})/(?P<season>\d{4})$', views.charts,
name='charts'),
re_path(r'^charts/(?P<ls>\w{3,})/(?P<season>\d{4})/(?P<pos>\w{1,})$',
views.charts, name='charts'),
re_path(r'^accounts/profile/(\d+)', views.profile),
re_path(r'^accounts/', include('django.contrib.auth.urls')),
re_path(r'^blog/newpost$', views.newBlogpost),
re_path(r'^blog/(?P<page>\d)$', views.blogindex),
re_path(r'^about$', views.about),
re_path(r'^accounts/login/', auth_views.LoginView.as_view()),
re_path(r'^accounts/logout/', auth_views.LogoutView.as_view())
]
# Redirect on logout
LOGOUT_REDIRECT_URL = "home"
if settings.DEBUG is True:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)