django.conf.urls.url is deprecated, more to fix

This commit is contained in:
Ariel Rin 2022-02-02 21:39:37 +10:00
parent 234451a7d4
commit c7b99044bc
6 changed files with 48 additions and 47 deletions

View File

@ -1,14 +1,15 @@
from django.conf.urls import url, include from django.conf.urls import include
from allianceauth.authentication import views from allianceauth.authentication import views
from django.urls import re_path
urlpatterns = [ urlpatterns = [
url(r'^activate/complete/$', views.activation_complete, name='registration_activation_complete'), re_path(r'^activate/complete/$', views.activation_complete, name='registration_activation_complete'),
# The activation key can make use of any character from the # The activation key can make use of any character from the
# URL-safe base64 alphabet, plus the colon as a separator. # URL-safe base64 alphabet, plus the colon as a separator.
url(r'^activate/(?P<activation_key>[-:\w]+)/$', views.ActivationView.as_view(), name='registration_activate'), re_path(r'^activate/(?P<activation_key>[-:\w]+)/$', views.ActivationView.as_view(), name='registration_activate'),
url(r'^register/$', views.RegistrationView.as_view(), name='registration_register'), re_path(r'^register/$', views.RegistrationView.as_view(), name='registration_register'),
url(r'^register/complete/$', views.registration_complete, name='registration_complete'), re_path(r'^register/complete/$', views.registration_complete, name='registration_complete'),
url(r'^register/closed/$', views.registration_closed, name='registration_disallowed'), re_path(r'^register/closed/$', views.registration_closed, name='registration_disallowed'),
url(r'', include('django.contrib.auth.urls')), re_path(r'', include('django.contrib.auth.urls')),
] ]

View File

@ -11,7 +11,7 @@ from allianceauth.eveonline.models import EveCharacter
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
state_changed = Signal(providing_args=['user', 'state']) state_changed = Signal()
def trigger_state_check(state): def trigger_state_check(state):

View File

@ -1,5 +1,5 @@
from django.conf.urls import url
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.urls import re_path
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from . import views from . import views
@ -7,21 +7,21 @@ from . import views
app_name = 'authentication' app_name = 'authentication'
urlpatterns = [ urlpatterns = [
url(r'^$', views.index, name='index'), re_path(r'^$', views.index, name='index'),
url( re_path(
r'^account/login/$', r'^account/login/$',
TemplateView.as_view(template_name='public/login.html'), TemplateView.as_view(template_name='public/login.html'),
name='login' name='login'
), ),
url( re_path(
r'^account/characters/main/$', r'^account/characters/main/$',
views.main_character_change, views.main_character_change,
name='change_main_character' name='change_main_character'
), ),
url( re_path(
r'^account/characters/add/$', r'^account/characters/add/$',
views.add_character, views.add_character,
name='add_character' name='add_character'
), ),
url(r'^dashboard/$', views.dashboard, name='dashboard'), re_path(r'^dashboard/$', views.dashboard, name='dashboard'),
] ]

View File

@ -1,12 +1,11 @@
from django.conf.urls import url from django.urls import re_path
from . import views from . import views
app_name = 'corputils' app_name = 'corputils'
urlpatterns = [ urlpatterns = [
url(r'^$', views.corpstats_view, name='view'), re_path(r'^$', views.corpstats_view, name='view'),
url(r'^add/$', views.corpstats_add, name='add'), re_path(r'^add/$', views.corpstats_add, name='add'),
url(r'^(?P<corp_id>(\d)*)/$', views.corpstats_view, name='view_corp'), re_path(r'^(?P<corp_id>(\d)*)/$', views.corpstats_view, name='view_corp'),
url(r'^(?P<corp_id>(\d)+)/update/$', views.corpstats_update, name='update'), re_path(r'^(?P<corp_id>(\d)+)/update/$', views.corpstats_update, name='update'),
url(r'^search/$', views.corpstats_search, name='search'), re_path(r'^search/$', views.corpstats_search, name='search'),
] ]

View File

@ -1,30 +1,30 @@
from django.conf.urls import url from django.urls import re_path
from . import views from . import views
app_name = 'fleetactivitytracking' app_name = 'fleetactivitytracking'
urlpatterns = [ urlpatterns = [
# FleetActivityTracking (FAT) # FleetActivityTracking (FAT)
url(r'^$', views.fatlink_view, name='view'), re_path(r'^$', views.fatlink_view, name='view'),
url(r'^statistics/$', views.fatlink_statistics_view, name='statistics'), re_path(r'^statistics/$', views.fatlink_statistics_view, name='statistics'),
url(r'^statistics/corp/(\w+)$', views.fatlink_statistics_corp_view, re_path(r'^statistics/corp/(\w+)$', views.fatlink_statistics_corp_view,
name='statistics_corp'), name='statistics_corp'),
url(r'^statistics/corp/(?P<corpid>\w+)/(?P<year>[0-9]+)/(?P<month>[0-9]+)/', re_path(r'^statistics/corp/(?P<corpid>\w+)/(?P<year>[0-9]+)/(?P<month>[0-9]+)/',
views.fatlink_statistics_corp_view, views.fatlink_statistics_corp_view,
name='statistics_corp_month'), name='statistics_corp_month'),
url(r'^statistics/(?P<year>[0-9]+)/(?P<month>[0-9]+)/$', views.fatlink_statistics_view, re_path(r'^statistics/(?P<year>[0-9]+)/(?P<month>[0-9]+)/$', views.fatlink_statistics_view,
name='statistics_month'), name='statistics_month'),
url(r'^user/statistics/$', views.fatlink_personal_statistics_view, re_path(r'^user/statistics/$', views.fatlink_personal_statistics_view,
name='personal_statistics'), name='personal_statistics'),
url(r'^user/statistics/(?P<year>[0-9]+)/$', views.fatlink_personal_statistics_view, re_path(r'^user/statistics/(?P<year>[0-9]+)/$', views.fatlink_personal_statistics_view,
name='personal_statistics_year'), name='personal_statistics_year'),
url(r'^user/statistics/(?P<year>[0-9]+)/(?P<month>[0-9]+)/$', re_path(r'^user/statistics/(?P<year>[0-9]+)/(?P<month>[0-9]+)/$',
views.fatlink_monthly_personal_statistics_view, views.fatlink_monthly_personal_statistics_view,
name='personal_statistics_month'), name='personal_statistics_month'),
url(r'^user/(?P<char_id>[0-9]+)/statistics/(?P<year>[0-9]+)/(?P<month>[0-9]+)/$', re_path(r'^user/(?P<char_id>[0-9]+)/statistics/(?P<year>[0-9]+)/(?P<month>[0-9]+)/$',
views.fatlink_monthly_personal_statistics_view, views.fatlink_monthly_personal_statistics_view,
name='user_statistics_month'), name='user_statistics_month'),
url(r'^create/$', views.create_fatlink_view, name='create'), re_path(r'^create/$', views.create_fatlink_view, name='create'),
url(r'^modify/(?P<fat_hash>[a-zA-Z0-9_-]+)/$', views.modify_fatlink_view, name='modify'), re_path(r'^modify/(?P<fat_hash>[a-zA-Z0-9_-]+)/$', views.modify_fatlink_view, name='modify'),
url(r'^link/(?P<fat_hash>[a-zA-Z0-9]+)/$', views.click_fatlink_view, name='click'), re_path(r'^link/(?P<fat_hash>[a-zA-Z0-9]+)/$', views.click_fatlink_view, name='click'),
] ]

View File

@ -1,6 +1,7 @@
from django.urls import re_path
import esi.urls import esi.urls
from django.conf.urls import include, url from django.conf.urls import include
from django.contrib import admin from django.contrib import admin
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
@ -21,35 +22,35 @@ admin.site.site_header = NAME
# Functional/Untranslated URL's # Functional/Untranslated URL's
urlpatterns = [ urlpatterns = [
# Locale # Locale
url(r'^i18n/', include('django.conf.urls.i18n')), re_path(r'^i18n/', include('django.conf.urls.i18n')),
# Authentication # Authentication
url(r'', include(allianceauth.authentication.urls)), re_path(r'', include(allianceauth.authentication.urls)),
url(r'^account/login/$', TemplateView.as_view(template_name='public/login.html'), name='auth_login_user'), re_path(r'^account/login/$', TemplateView.as_view(template_name='public/login.html'), name='auth_login_user'),
url(r'^account/', include(hmac_urls)), re_path(r'^account/', include(hmac_urls)),
# Admin urls # Admin urls
url(r'^admin/', admin.site.urls), re_path(r'^admin/', admin.site.urls),
# SSO # SSO
url(r'^sso/', include((esi.urls, 'esi'), namespace='esi')), re_path(r'^sso/', include((esi.urls, 'esi'), namespace='esi')),
url(r'^sso/login$', allianceauth.authentication.views.sso_login, name='auth_sso_login'), re_path(r'^sso/login$', allianceauth.authentication.views.sso_login, name='auth_sso_login'),
# Notifications # Notifications
url(r'', include(allianceauth.notifications.urls)), re_path(r'', include(allianceauth.notifications.urls)),
# Groups # Groups
url(r'', include(allianceauth.groupmanagement.urls)), re_path(r'', include(allianceauth.groupmanagement.urls)),
# Services # Services
url(r'', decorate_url_patterns(allianceauth.services.urls.urlpatterns, main_character_required)), re_path(r'', decorate_url_patterns(allianceauth.services.urls.urlpatterns, main_character_required)),
# Night mode # Night mode
url(r'^night/', views.NightModeRedirectView.as_view(), name='nightmode') re_path(r'^night/', views.NightModeRedirectView.as_view(), name='nightmode')
] ]
# Append app urls # Append app urls
app_urls = get_hooks('url_hook') app_urls = get_hooks('url_hook')
for app in app_urls: for app in app_urls:
urlpatterns += [url(r'', decorate_url_patterns([app().include_pattern], main_character_required))] urlpatterns += [re_path(r'', decorate_url_patterns([app().include_pattern], main_character_required))]