Refactor usage of django.conf.urls

django.conf.urls.url() was removed in Django 4.0:
https://docs.djangoproject.com/en/4.2/releases/4.0/#features-removed-in-4-0

Replace all usage with django.urls.re_path()
Replace all django.conf.urls imports with equivalent django.urls modules

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
This commit is contained in:
Tim Orling 2023-08-30 12:09:40 -07:00
parent bd58fbe7df
commit abef2b6a19
4 changed files with 88 additions and 92 deletions

View File

@ -6,10 +6,9 @@
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
from django.conf.urls import *
from django.views.generic import TemplateView, DetailView, ListView, RedirectView from django.views.generic import TemplateView, DetailView, ListView, RedirectView
from django.views.defaults import page_not_found from django.views.defaults import page_not_found
from django.urls import reverse_lazy from django.urls import include, re_path, reverse_lazy
from layerindex.views import LayerListView, LayerReviewListView, LayerReviewDetailView, RecipeSearchView, \ from layerindex.views import LayerListView, LayerReviewListView, LayerReviewDetailView, RecipeSearchView, \
MachineSearchView, LayerDetailView, edit_layer_view, delete_layer_view, edit_layernote_view, delete_layernote_view, \ MachineSearchView, LayerDetailView, edit_layer_view, delete_layer_view, edit_layernote_view, delete_layernote_view, \
HistoryListView, EditProfileFormView, AdvancedRecipeSearchView, BulkChangeView, BulkChangeSearchView, \ HistoryListView, EditProfileFormView, AdvancedRecipeSearchView, BulkChangeView, BulkChangeSearchView, \
@ -21,7 +20,6 @@ from layerindex.views import LayerListView, LayerReviewListView, LayerReviewDeta
from layerindex.models import LayerItem, Recipe, RecipeChangeset from layerindex.models import LayerItem, Recipe, RecipeChangeset
from rest_framework import routers from rest_framework import routers
from . import restviews from . import restviews
from django.conf.urls import include
router = routers.DefaultRouter() router = routers.DefaultRouter()
router.register(r'branches', restviews.BranchViewSet) router.register(r'branches', restviews.BranchViewSet)
@ -40,174 +38,174 @@ router.register(r'appends', restviews.AppendViewSet)
router.register(r'incFiles', restviews.IncFileViewSet) router.register(r'incFiles', restviews.IncFileViewSet)
urlpatterns = [ urlpatterns = [
url(r'^$', re_path(r'^$',
RedirectView.as_view(url=reverse_lazy('layer_list', args=('master',)), permanent=False), RedirectView.as_view(url=reverse_lazy('layer_list', args=('master',)), permanent=False),
name='frontpage'), name='frontpage'),
url(r'^api/', include(router.urls)), re_path(r'^api/', include(router.urls)),
url(r'^layers/$', re_path(r'^layers/$',
RedirectView.as_view(url=reverse_lazy('layer_list', args=('master',)), permanent=False)), RedirectView.as_view(url=reverse_lazy('layer_list', args=('master',)), permanent=False)),
url(r'^layer/(?P<slug>[-\w]+)/$', re_path(r'^layer/(?P<slug>[-\w]+)/$',
RedirectParamsView.as_view(permanent=False), {'redirect_name': 'layer_item', 'branch': 'master'}), RedirectParamsView.as_view(permanent=False), {'redirect_name': 'layer_item', 'branch': 'master'}),
url(r'^recipes/$', re_path(r'^recipes/$',
RedirectView.as_view(url=reverse_lazy('recipe_search', args=('master',)), permanent=False)), RedirectView.as_view(url=reverse_lazy('recipe_search', args=('master',)), permanent=False)),
url(r'^machines/$', re_path(r'^machines/$',
RedirectView.as_view(url=reverse_lazy('machine_search', args=('master',)), permanent=False)), RedirectView.as_view(url=reverse_lazy('machine_search', args=('master',)), permanent=False)),
url(r'^distros/$', re_path(r'^distros/$',
RedirectView.as_view(url=reverse_lazy('distro_search', args=('master',)), permanent=False)), RedirectView.as_view(url=reverse_lazy('distro_search', args=('master',)), permanent=False)),
url(r'^classes/$', re_path(r'^classes/$',
RedirectView.as_view(url=reverse_lazy('class_search', args=('master',)), permanent=False)), RedirectView.as_view(url=reverse_lazy('class_search', args=('master',)), permanent=False)),
url(r'^submit/$', edit_layer_view, {'template_name': 'layerindex/submitlayer.html'}, name="submit_layer"), re_path(r'^submit/$', edit_layer_view, {'template_name': 'layerindex/submitlayer.html'}, name="submit_layer"),
url(r'^submit/thanks/$', re_path(r'^submit/thanks/$',
TemplateView.as_view( TemplateView.as_view(
template_name='layerindex/submitthanks.html'), template_name='layerindex/submitthanks.html'),
name="submit_layer_thanks"), name="submit_layer_thanks"),
url(r'^review/$', re_path(r'^review/$',
LayerReviewListView.as_view( LayerReviewListView.as_view(
template_name='layerindex/reviewlist.html'), template_name='layerindex/reviewlist.html'),
name='layer_list_review'), name='layer_list_review'),
url(r'^review/(?P<slug>[-\w]+)/$', re_path(r'^review/(?P<slug>[-\w]+)/$',
LayerReviewDetailView.as_view( LayerReviewDetailView.as_view(
template_name='layerindex/reviewdetail.html'), template_name='layerindex/reviewdetail.html'),
name='layer_review'), name='layer_review'),
url(r'^layer/(?P<slug>[-\w]+)/addnote/$', re_path(r'^layer/(?P<slug>[-\w]+)/addnote/$',
edit_layernote_view, {'template_name': 'layerindex/editlayernote.html'}, name="add_layernote"), edit_layernote_view, {'template_name': 'layerindex/editlayernote.html'}, name="add_layernote"),
url(r'^layer/(?P<slug>[-\w]+)/editnote/(?P<pk>[-\w]+)/$', re_path(r'^layer/(?P<slug>[-\w]+)/editnote/(?P<pk>[-\w]+)/$',
edit_layernote_view, {'template_name': 'layerindex/editlayernote.html'}, name="edit_layernote"), edit_layernote_view, {'template_name': 'layerindex/editlayernote.html'}, name="edit_layernote"),
url(r'^layer/(?P<slug>[-\w]+)/deletenote/(?P<pk>[-\w]+)/$', re_path(r'^layer/(?P<slug>[-\w]+)/deletenote/(?P<pk>[-\w]+)/$',
delete_layernote_view, {'template_name': 'layerindex/deleteconfirm.html'}, name="delete_layernote"), delete_layernote_view, {'template_name': 'layerindex/deleteconfirm.html'}, name="delete_layernote"),
url(r'^layer/(?P<slug>[-\w]+)/delete/$', re_path(r'^layer/(?P<slug>[-\w]+)/delete/$',
delete_layer_view, {'template_name': 'layerindex/deleteconfirm.html'}, name="delete_layer"), delete_layer_view, {'template_name': 'layerindex/deleteconfirm.html'}, name="delete_layer"),
url(r'^recipe/(?P<pk>[-\w]+)/$', re_path(r'^recipe/(?P<pk>[-\w]+)/$',
RecipeDetailView.as_view( RecipeDetailView.as_view(
template_name='layerindex/recipedetail.html'), template_name='layerindex/recipedetail.html'),
name='recipe'), name='recipe'),
url(r'^layer/(?P<name>[-\w]+)/publish/$', publish_view, name="publish"), re_path(r'^layer/(?P<name>[-\w]+)/publish/$', publish_view, name="publish"),
url(r'^layerupdate/(?P<pk>[-\w]+)/$', re_path(r'^layerupdate/(?P<pk>[-\w]+)/$',
LayerUpdateDetailView.as_view( LayerUpdateDetailView.as_view(
template_name='layerindex/layerupdate.html'), template_name='layerindex/layerupdate.html'),
name='layerupdate'), name='layerupdate'),
url(r'^bulkchange/$', re_path(r'^bulkchange/$',
BulkChangeView.as_view( BulkChangeView.as_view(
template_name='layerindex/bulkchange.html'), template_name='layerindex/bulkchange.html'),
name="bulk_change"), name="bulk_change"),
url(r'^bulkchange/(?P<pk>\d+)/search/$', re_path(r'^bulkchange/(?P<pk>\d+)/search/$',
BulkChangeSearchView.as_view( BulkChangeSearchView.as_view(
template_name='layerindex/bulkchangesearch.html'), template_name='layerindex/bulkchangesearch.html'),
name="bulk_change_search"), name="bulk_change_search"),
url(r'^bulkchange/(?P<pk>\d+)/edit/$', re_path(r'^bulkchange/(?P<pk>\d+)/edit/$',
bulk_change_edit_view, {'template_name': 'layerindex/bulkchangeedit.html'}, name="bulk_change_edit"), bulk_change_edit_view, {'template_name': 'layerindex/bulkchangeedit.html'}, name="bulk_change_edit"),
url(r'^bulkchange/(?P<pk>\d+)/review/$', re_path(r'^bulkchange/(?P<pk>\d+)/review/$',
DetailView.as_view( DetailView.as_view(
model=RecipeChangeset, model=RecipeChangeset,
context_object_name='changeset', context_object_name='changeset',
template_name='layerindex/bulkchangereview.html'), template_name='layerindex/bulkchangereview.html'),
name="bulk_change_review"), name="bulk_change_review"),
url(r'^bulkchange/(?P<pk>\d+)/patches/$', re_path(r'^bulkchange/(?P<pk>\d+)/patches/$',
bulk_change_patch_view, name="bulk_change_patches"), bulk_change_patch_view, name="bulk_change_patches"),
url(r'^bulkchange/(?P<pk>\d+)/delete/$', re_path(r'^bulkchange/(?P<pk>\d+)/delete/$',
BulkChangeDeleteView.as_view( BulkChangeDeleteView.as_view(
template_name='layerindex/deleteconfirm.html'), template_name='layerindex/deleteconfirm.html'),
name="bulk_change_delete"), name="bulk_change_delete"),
url(r'^branch/(?P<branch>[-.\w]+)/', re_path(r'^branch/(?P<branch>[-.\w]+)/',
include('layerindex.urls_branch')), include('layerindex.urls_branch')),
url(r'^updates/$', re_path(r'^updates/$',
UpdateListView.as_view( UpdateListView.as_view(
template_name='layerindex/updatelist.html'), template_name='layerindex/updatelist.html'),
name='update_list'), name='update_list'),
url(r'^updates/(?P<pk>[-\w]+)/$', re_path(r'^updates/(?P<pk>[-\w]+)/$',
UpdateDetailView.as_view( UpdateDetailView.as_view(
template_name='layerindex/updatedetail.html'), template_name='layerindex/updatedetail.html'),
name='update'), name='update'),
url(r'^history/$', re_path(r'^history/$',
HistoryListView.as_view( HistoryListView.as_view(
template_name='layerindex/history.html'), template_name='layerindex/history.html'),
name='history_list'), name='history_list'),
url(r'^profile/$', re_path(r'^profile/$',
EditProfileFormView.as_view( EditProfileFormView.as_view(
template_name='layerindex/profile.html'), template_name='layerindex/profile.html'),
name="profile"), name="profile"),
url(r'^about/$', re_path(r'^about/$',
TemplateView.as_view( TemplateView.as_view(
template_name='layerindex/about.html'), template_name='layerindex/about.html'),
name="about"), name="about"),
url(r'^stats/$', re_path(r'^stats/$',
StatsView.as_view( StatsView.as_view(
template_name='layerindex/stats.html'), template_name='layerindex/stats.html'),
name='stats'), name='stats'),
url(r'^oe-classic/$', re_path(r'^oe-classic/$',
RedirectView.as_view(url=reverse_lazy('classic_recipe_search'), permanent=False), RedirectView.as_view(url=reverse_lazy('classic_recipe_search'), permanent=False),
name='classic'), name='classic'),
url(r'^oe-classic/recipes/$', re_path(r'^oe-classic/recipes/$',
RedirectView.as_view(url=reverse_lazy('comparison_recipe_search', kwargs={'branch': 'oe-classic'}), permanent=False), RedirectView.as_view(url=reverse_lazy('comparison_recipe_search', kwargs={'branch': 'oe-classic'}), permanent=False),
name='classic_recipe_search'), name='classic_recipe_search'),
url(r'^oe-classic/stats/$', re_path(r'^oe-classic/stats/$',
RedirectView.as_view(url=reverse_lazy('comparison_recipe_stats', kwargs={'branch': 'oe-classic'}), permanent=False), RedirectView.as_view(url=reverse_lazy('comparison_recipe_stats', kwargs={'branch': 'oe-classic'}), permanent=False),
name='classic_recipe_stats'), name='classic_recipe_stats'),
url(r'^oe-classic/recipe/(?P<pk>[-\w]+)/$', re_path(r'^oe-classic/recipe/(?P<pk>[-\w]+)/$',
ClassicRecipeDetailView.as_view( ClassicRecipeDetailView.as_view(
template_name='layerindex/classicrecipedetail.html'), template_name='layerindex/classicrecipedetail.html'),
name='classic_recipe'), name='classic_recipe'),
url(r'^comparison/recipes/(?P<branch>[-.\w]+)/$', re_path(r'^comparison/recipes/(?P<branch>[-.\w]+)/$',
ClassicRecipeSearchView.as_view( ClassicRecipeSearchView.as_view(
template_name='layerindex/classicrecipes.html'), template_name='layerindex/classicrecipes.html'),
name='comparison_recipe_search'), name='comparison_recipe_search'),
url(r'^comparison/search-csv/(?P<branch>[-.\w]+)/$', re_path(r'^comparison/search-csv/(?P<branch>[-.\w]+)/$',
ClassicRecipeSearchView.as_view( ClassicRecipeSearchView.as_view(
template_name='layerindex/classicrecipes_csv.txt', template_name='layerindex/classicrecipes_csv.txt',
paginate_by=0, paginate_by=0,
content_type='text/csv; charset=utf-8'), content_type='text/csv; charset=utf-8'),
name='comparison_recipe_search_csv'), name='comparison_recipe_search_csv'),
url(r'^comparison/stats/(?P<branch>[-.\w]+)/$', re_path(r'^comparison/stats/(?P<branch>[-.\w]+)/$',
ClassicRecipeStatsView.as_view( ClassicRecipeStatsView.as_view(
template_name='layerindex/classicstats.html'), template_name='layerindex/classicstats.html'),
name='comparison_recipe_stats'), name='comparison_recipe_stats'),
url(r'^comparison/recipe/(?P<pk>[-\w]+)/$', re_path(r'^comparison/recipe/(?P<pk>[-\w]+)/$',
ClassicRecipeDetailView.as_view( ClassicRecipeDetailView.as_view(
template_name='layerindex/classicrecipedetail.html'), template_name='layerindex/classicrecipedetail.html'),
name='comparison_recipe'), name='comparison_recipe'),
url(r'^comparison/select/(?P<pk>[-\w]+)/$', re_path(r'^comparison/select/(?P<pk>[-\w]+)/$',
ComparisonRecipeSelectView.as_view( ComparisonRecipeSelectView.as_view(
template_name='layerindex/comparisonrecipeselect.html'), template_name='layerindex/comparisonrecipeselect.html'),
name='comparison_select'), name='comparison_select'),
url(r'^comparison/selectdetail/(?P<selectfor>[-\w]+)/(?P<pk>[-\w]+)/$', re_path(r'^comparison/selectdetail/(?P<selectfor>[-\w]+)/(?P<pk>[-\w]+)/$',
ComparisonRecipeSelectDetailView.as_view( ComparisonRecipeSelectDetailView.as_view(
template_name='layerindex/comparisonrecipeselectdetail.html'), template_name='layerindex/comparisonrecipeselectdetail.html'),
name='comparison_select_detail'), name='comparison_select_detail'),
url(r'^email_test/$', re_path(r'^email_test/$',
email_test_view, email_test_view,
name='email_test'), name='email_test'),
url(r'^task/(?P<task_id>[-\w]+)/$', re_path(r'^task/(?P<task_id>[-\w]+)/$',
TaskStatusView.as_view( TaskStatusView.as_view(
template_name='layerindex/task.html'), template_name='layerindex/task.html'),
name='task_status'), name='task_status'),
url(r'^tasklog/(?P<task_id>[-\w]+)/$', re_path(r'^tasklog/(?P<task_id>[-\w]+)/$',
task_log_view, task_log_view,
name='task_log'), name='task_log'),
url(r'^stoptask/(?P<task_id>[-\w]+)/$', re_path(r'^stoptask/(?P<task_id>[-\w]+)/$',
task_stop_view, task_stop_view,
name='task_stop'), name='task_stop'),
url(r'^branch_comparison/$', re_path(r'^branch_comparison/$',
BranchCompareView.as_view( BranchCompareView.as_view(
template_name='layerindex/branchcompare.html'), template_name='layerindex/branchcompare.html'),
name='branch_comparison'), name='branch_comparison'),
url(r'^branch_comparison_plain/$', re_path(r'^branch_comparison_plain/$',
BranchCompareView.as_view( BranchCompareView.as_view(
content_type='text/plain; charset=utf-8', content_type='text/plain; charset=utf-8',
template_name='layerindex/branchcompare_plain.txt'), template_name='layerindex/branchcompare_plain.txt'),
name='branch_comparison_plain'), name='branch_comparison_plain'),
url(r'^recipe_deps/$', re_path(r'^recipe_deps/$',
RecipeDependenciesView.as_view( RecipeDependenciesView.as_view(
template_name='layerindex/recipedeps.html'), template_name='layerindex/recipedeps.html'),
name='recipe_deps'), name='recipe_deps'),
url(r'^ajax/layerchecklist/(?P<branch>[-.\w]+)/$', re_path(r'^ajax/layerchecklist/(?P<branch>[-.\w]+)/$',
LayerCheckListView.as_view( LayerCheckListView.as_view(
template_name='layerindex/layerchecklist.html'), template_name='layerindex/layerchecklist.html'),
name='layer_checklist'), name='layer_checklist'),
url(r'^ajax/classchecklist/(?P<branch>[-.\w]+)/$', re_path(r'^ajax/classchecklist/(?P<branch>[-.\w]+)/$',
BBClassCheckListView.as_view( BBClassCheckListView.as_view(
template_name='layerindex/classchecklist.html'), template_name='layerindex/classchecklist.html'),
name='class_checklist'), name='class_checklist'),
url(r'.*', page_not_found, kwargs={'exception': Exception("Page not Found")}) re_path(r'.*', page_not_found, kwargs={'exception': Exception("Page not Found")})
] ]

View File

@ -6,47 +6,46 @@
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
from django.conf.urls import *
from django.views.defaults import page_not_found from django.views.defaults import page_not_found
from django.urls import reverse_lazy from django.urls import include, re_path, reverse_lazy
from layerindex.views import LayerListView, RecipeSearchView, MachineSearchView, DistroSearchView, ClassSearchView, LayerDetailView, edit_layer_view, delete_layer_view, edit_layernote_view, delete_layernote_view, RedirectParamsView, DuplicatesView, LayerUpdateDetailView, layer_export_recipes_csv_view, comparison_update_view from layerindex.views import LayerListView, RecipeSearchView, MachineSearchView, DistroSearchView, ClassSearchView, LayerDetailView, edit_layer_view, delete_layer_view, edit_layernote_view, delete_layernote_view, RedirectParamsView, DuplicatesView, LayerUpdateDetailView, layer_export_recipes_csv_view, comparison_update_view
urlpatterns = [ urlpatterns = [
url(r'^$', re_path(r'^$',
RedirectParamsView.as_view(permanent=False), {'redirect_name': 'layer_list'}), RedirectParamsView.as_view(permanent=False), {'redirect_name': 'layer_list'}),
url(r'^layers/$', re_path(r'^layers/$',
LayerListView.as_view( LayerListView.as_view(
template_name='layerindex/layers.html'), template_name='layerindex/layers.html'),
name='layer_list'), name='layer_list'),
url(r'^layer/(?P<slug>[-\w]+)/$', re_path(r'^layer/(?P<slug>[-\w]+)/$',
LayerDetailView.as_view( LayerDetailView.as_view(
template_name='layerindex/detail.html'), template_name='layerindex/detail.html'),
name='layer_item'), name='layer_item'),
url(r'^layer/(?P<slug>[-\w]+)/recipes/csv/$', re_path(r'^layer/(?P<slug>[-\w]+)/recipes/csv/$',
layer_export_recipes_csv_view, layer_export_recipes_csv_view,
name='layer_export_recipes_csv'), name='layer_export_recipes_csv'),
url(r'^recipes/$', re_path(r'^recipes/$',
RecipeSearchView.as_view( RecipeSearchView.as_view(
template_name='layerindex/recipes.html'), template_name='layerindex/recipes.html'),
name='recipe_search'), name='recipe_search'),
url(r'^machines/$', re_path(r'^machines/$',
MachineSearchView.as_view( MachineSearchView.as_view(
template_name='layerindex/machines.html'), template_name='layerindex/machines.html'),
name='machine_search'), name='machine_search'),
url(r'^distros/$', re_path(r'^distros/$',
DistroSearchView.as_view( DistroSearchView.as_view(
template_name='layerindex/distros.html'), template_name='layerindex/distros.html'),
name='distro_search'), name='distro_search'),
url(r'^classes/$', re_path(r'^classes/$',
ClassSearchView.as_view( ClassSearchView.as_view(
template_name='layerindex/classes.html'), template_name='layerindex/classes.html'),
name='class_search'), name='class_search'),
url(r'^edit/(?P<slug>[-\w]+)/$', edit_layer_view, {'template_name': 'layerindex/editlayer.html'}, name="edit_layer"), re_path(r'^edit/(?P<slug>[-\w]+)/$', edit_layer_view, {'template_name': 'layerindex/editlayer.html'}, name="edit_layer"),
url(r'^duplicates/$', re_path(r'^duplicates/$',
DuplicatesView.as_view( DuplicatesView.as_view(
template_name='layerindex/duplicates.html'), template_name='layerindex/duplicates.html'),
name='duplicates'), name='duplicates'),
url(r'^comparison_update/$', re_path(r'^comparison_update/$',
comparison_update_view, comparison_update_view,
name='comparison_update'), name='comparison_update'),
] ]

View File

@ -6,7 +6,7 @@
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
from django.conf.urls import include, url from django.urls import include, re_path
from rrs.models import Release, Milestone from rrs.models import Release, Milestone
from rrs.views import RecipeListView, recipes_report, RecipeDetailView, \ from rrs.views import RecipeListView, recipes_report, RecipeDetailView, \
@ -14,27 +14,27 @@ from rrs.views import RecipeListView, recipes_report, RecipeDetailView, \
MaintenanceStatsView MaintenanceStatsView
urlpatterns = [ urlpatterns = [
url(r'^$', FrontPageRedirect.as_view(), re_path(r'^$', FrontPageRedirect.as_view(),
name='rrs_frontpage'), name='rrs_frontpage'),
url(r'^maintplan/(?P<maintplan_name>.*)/$', re_path(r'^maintplan/(?P<maintplan_name>.*)/$',
MaintenancePlanRedirect.as_view(), MaintenancePlanRedirect.as_view(),
name='rrs_maintplan'), name='rrs_maintplan'),
url(r'^recipes/(?P<maintplan_name>.*)/(?P<release_name>.*)/(?P<milestone_name>.*)/$', re_path(r'^recipes/(?P<maintplan_name>.*)/(?P<release_name>.*)/(?P<milestone_name>.*)/$',
RecipeListView.as_view( RecipeListView.as_view(
template_name='rrs/recipes.html'), template_name='rrs/recipes.html'),
name='rrs_recipes'), name='rrs_recipes'),
url(r'^recipesreport/(?P<maintplan_name>.*)/(?P<release_name>.*)/(?P<milestone_name>.*)/$', re_path(r'^recipesreport/(?P<maintplan_name>.*)/(?P<release_name>.*)/(?P<milestone_name>.*)/$',
recipes_report, recipes_report,
name="rrs_recipesreport"), name="rrs_recipesreport"),
url(r'^recipedetail/(?P<maintplan_name>.*)/(?P<pk>\d+)/$', re_path(r'^recipedetail/(?P<maintplan_name>.*)/(?P<pk>\d+)/$',
RecipeDetailView.as_view( RecipeDetailView.as_view(
template_name='rrs/recipedetail.html'), template_name='rrs/recipedetail.html'),
name='rrs_recipedetail'), name='rrs_recipedetail'),
url(r'^maintainers/(?P<maintplan_name>.*)/(?P<release_name>.*)/(?P<milestone_name>.*)/$', re_path(r'^maintainers/(?P<maintplan_name>.*)/(?P<release_name>.*)/(?P<milestone_name>.*)/$',
MaintainerListView.as_view( MaintainerListView.as_view(
template_name='rrs/maintainers.html'), template_name='rrs/maintainers.html'),
name="rrs_maintainers"), name="rrs_maintainers"),
url(r'^stats/(?P<maintplan_name>.*)/(?P<release_name>.*)/(?P<milestone_name>.*)/$', re_path(r'^stats/(?P<maintplan_name>.*)/(?P<release_name>.*)/(?P<milestone_name>.*)/$',
MaintenanceStatsView.as_view( MaintenanceStatsView.as_view(
template_name='rrs/rrs_stats.html'), template_name='rrs/rrs_stats.html'),
name="rrs_stats"), name="rrs_stats"),

31
urls.py
View File

@ -7,8 +7,7 @@
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
from django.conf.urls import include, url from django.urls import include, re_path, reverse_lazy
from django.urls import reverse_lazy
from django.views.generic import RedirectView, TemplateView from django.views.generic import RedirectView, TemplateView
from layerindex.auth_views import CaptchaRegistrationView, CaptchaPasswordResetView, delete_account_view, \ from layerindex.auth_views import CaptchaRegistrationView, CaptchaPasswordResetView, delete_account_view, \
PasswordResetSecurityQuestions PasswordResetSecurityQuestions
@ -18,40 +17,40 @@ admin.autodiscover()
import settings import settings
urlpatterns = [ urlpatterns = [
url(r'^layerindex/', include('layerindex.urls')), re_path(r'^layerindex/', include('layerindex.urls')),
url(r'^admin/', admin.site.urls), re_path(r'^admin/', admin.site.urls),
url(r'^accounts/password_reset/$', re_path(r'^accounts/password_reset/$',
CaptchaPasswordResetView.as_view( CaptchaPasswordResetView.as_view(
email_template_name='registration/password_reset_email.txt', email_template_name='registration/password_reset_email.txt',
success_url=reverse_lazy('password_reset_done')), success_url=reverse_lazy('password_reset_done')),
name='password_reset'), name='password_reset'),
url(r'^accounts/register/$', CaptchaRegistrationView.as_view(), re_path(r'^accounts/register/$', CaptchaRegistrationView.as_view(),
name='django_registration_register'), name='django_registration_register'),
url(r'^accounts/delete/$', delete_account_view, re_path(r'^accounts/delete/$', delete_account_view,
{'template_name': 'layerindex/deleteaccount.html'}, {'template_name': 'layerindex/deleteaccount.html'},
name='delete_account'), name='delete_account'),
url(r'^accounts/reregister/$', TemplateView.as_view( re_path(r'^accounts/reregister/$', TemplateView.as_view(
template_name='registration/reregister.html'), template_name='registration/reregister.html'),
name='reregister'), name='reregister'),
url(r'^accounts/reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,3}-[0-9A-Za-z]{1,20})/$', re_path(r'^accounts/reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,3}-[0-9A-Za-z]{1,20})/$',
PasswordResetSecurityQuestions.as_view(), PasswordResetSecurityQuestions.as_view(),
name='password_reset_confirm', name='password_reset_confirm',
), ),
url(r'^accounts/reset/fail/$', TemplateView.as_view( re_path(r'^accounts/reset/fail/$', TemplateView.as_view(
template_name='registration/password_reset_fail.html'), template_name='registration/password_reset_fail.html'),
name='password_reset_fail'), name='password_reset_fail'),
url(r'^accounts/lockout/$', TemplateView.as_view( re_path(r'^accounts/lockout/$', TemplateView.as_view(
template_name='registration/account_lockout.html'), template_name='registration/account_lockout.html'),
name='account_lockout'), name='account_lockout'),
url(r'^accounts/', include('django_registration.backends.activation.urls')), re_path(r'^accounts/', include('django_registration.backends.activation.urls')),
url(r'^accounts/', include('django.contrib.auth.urls')), re_path(r'^accounts/', include('django.contrib.auth.urls')),
url(r'^captcha/', include('captcha.urls')), re_path(r'^captcha/', include('captcha.urls')),
] ]
if 'rrs' in settings.INSTALLED_APPS: if 'rrs' in settings.INSTALLED_APPS:
urlpatterns += [ urlpatterns += [
url(r'^rrs/', include('rrs.urls')), re_path(r'^rrs/', include('rrs.urls')),
] ]
urlpatterns += [ urlpatterns += [
url(r'.*', RedirectView.as_view(url='/layerindex/', permanent=False)), re_path(r'.*', RedirectView.as_view(url='/layerindex/', permanent=False)),
] ]