FreedomBox/plinth/urls.py
Sunil Mohan Adapa cd2b2f5f2c
*: Use django.urls.re_path() instead of its alias url()
- In Django 2.2 django.conf.urls.url() is an alias to django.urls.re_path().

- In Django 4.0, url() function will be removed. On Django 3.2, it throws a
warning that this function will be removed in future.

Tests:

- Run unit tests with Django 3.2 and Django 2.2.

- With Django 3.2 there are no warnings when running unit tests and when running
FreedomBox Service.

- Visit a few affected apps with both Django versions.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-09-20 16:50:47 -04:00

39 lines
1.4 KiB
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Django URLconf file containing all urls
"""
from captcha import views as cviews
from django.urls import re_path
from stronghold.decorators import public
from plinth.modules.sso.views import CaptchaLoginView
from . import views
urlpatterns = [
re_path(r'^$', views.index, name='index'),
re_path(r'^language-selection/$',
public(views.LanguageSelectionView.as_view()),
name='language-selection'),
re_path(r'^apps/$', views.AppsIndexView.as_view(), name='apps'),
re_path(r'^sys/$', views.system_index, name='system'),
# captcha urls are public
re_path(r'^captcha/image/(?P<key>\w+)/$', public(cviews.captcha_image),
name='captcha-image', kwargs={'scale': 1}),
re_path(r'^captcha/image/(?P<key>\w+)@2/$', public(cviews.captcha_image),
name='captcha-image-2x', kwargs={'scale': 2}),
re_path(r'^captcha/audio/(?P<key>\w+)/$', public(cviews.captcha_audio),
name='captcha-audio'),
re_path(r'^captcha/refresh/$', public(cviews.captcha_refresh),
name='captcha-refresh'),
# locked url from django-axes
re_path(r'locked/$', public(CaptchaLoginView.as_view()),
name='locked_out'),
# Notifications
re_path(r'^notification/(?P<id>[A-Za-z0-9-=]+)/dismiss/$',
views.notification_dismiss, name='notification_dismiss')
]