Convert remaining url routes to path/re_path

This commit is contained in:
Ben Sturmfels 2024-03-18 18:38:30 +11:00
parent 8b805b313e
commit 33833e3a33
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0
4 changed files with 29 additions and 34 deletions

View file

@ -1,6 +1,6 @@
from datetime import datetime
from django.conf.urls import url
from django.urls import path
from ..staff.models import Person
from .models import Entry, EntryTag
@ -23,12 +23,12 @@ info_dict = {
}
urlpatterns = [
url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[-\w]+)/$', BlogDateDetailView.as_view(**info_dict)),
url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', BlogDayArchiveView.as_view(**info_dict)),
url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', BlogMonthArchiveView.as_view(**info_dict)),
url(r'^(?P<year>\d{4})/$', BlogYearArchiveView.as_view(**info_dict)),
url(r'^$', custom_index, dict(info_dict, paginate_by=4)),
url(r'^query/$', query),
path('<int:year>/<month>/<int:day>/<slug:slug>/', BlogDateDetailView.as_view(**info_dict)),
path('<int:year>/<month>/<int:day>/', BlogDayArchiveView.as_view(**info_dict)),
path('<int:year>/<month>/', BlogMonthArchiveView.as_view(**info_dict)),
path('<int:year>/', BlogYearArchiveView.as_view(**info_dict)),
path('', custom_index, dict(info_dict, paginate_by=4)),
path('query/', query),
]
# Code to display authors and tags on each blog page

View file

@ -18,7 +18,7 @@
# "AGPLv3". If not, see <http://www.gnu.org/licenses/>.
from django.conf import settings
from django.conf.urls import include, url
from django.urls import path
from .models import ExternalArticle, PressRelease
from .views import (
@ -39,9 +39,9 @@ external_article_dict = {
}
urlpatterns = [
url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[-\w]+)/$', NewsDateDetailView.as_view(**info_dict)),
url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', NewsDayArchiveView.as_view(**info_dict)),
url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', NewsMonthArchiveView.as_view(**info_dict)),
url(r'^(?P<year>\d{4})/$', NewsYearArchiveView.as_view(**info_dict)),
url(r'^$', listing, dict(info_dict, paginate_by=6)),
path('<int:year>/<month>/<int:day>/<slug:slug>/', NewsDateDetailView.as_view(**info_dict)),
path('<int:year>/<month>/<int:day>/', NewsDayArchiveView.as_view(**info_dict)),
path('<int:year>/<month>/', NewsMonthArchiveView.as_view(**info_dict)),
path('<int:year>/', NewsYearArchiveView.as_view(**info_dict)),
path('', listing, dict(info_dict, paginate_by=6)),
]

View file

@ -1,16 +1,12 @@
from django.conf.urls import url
from django.urls import path, re_path
from django.views.generic import TemplateView
from . import views as supp_views
from .. import views as static_views
INDEX_VIEW = supp_views.index
urlpatterns = [
url(r'^$', INDEX_VIEW),
url(r'^banners?/?$', TemplateView.as_view(template_name='supporter/banners.html')),
path('', supp_views.index),
path('banner/', TemplateView.as_view(template_name='supporter/banners.html')),
path('banners/', TemplateView.as_view(template_name='supporter/banners.html')),
re_path(r'', static_views.index),
]
urlpatterns.extend(
url(r'^{}(?:\.html|/|)$'.format(basename), INDEX_VIEW)
for basename in ['index', '2015-supporter-appeal', '2016-supporter-appeal']
)
urlpatterns.append(url(r'', static_views.index))

View file

@ -28,7 +28,6 @@ admin.autodiscover()
urlpatterns = [
path('', frontpage.view),
path('sponsors', frontpage.view),
path('sponsors/', sponsors.view),
path('sponsors/index.html', sponsors.view),
path('admin/', admin.site.urls),
@ -39,23 +38,23 @@ urlpatterns = [
path('news/', include('conservancy.news.urls')),
path('blog/', include('conservancy.blog.urls')),
# formerly static templated things... (dirs with templates)
re_path(r'^about', static_views.index),
re_path(r'^activities', static_views.index),
re_path(r'^donate', static_views.index),
re_path(r'^copyleft-compliance', static_views.index, {'fundraiser_sought': 'vmware-match-0'}),
re_path(r'^learn', static_views.index),
re_path(r'^press', static_views.index),
re_path(r'^projects', static_views.index),
re_path(r'^about/', static_views.index),
re_path(r'^activities/', static_views.index),
re_path(r'^donate/', static_views.index),
re_path(r'^copyleft-compliance/', static_views.index, {'fundraiser_sought': 'vmware-match-0'}),
re_path(r'^learn/', static_views.index),
re_path(r'^press/', static_views.index),
re_path(r'^projects/', static_views.index),
re_path(r'^GiveUpGitHub', static_views.index),
re_path(r'^npoacct', static_views.index, {'fundraiser_sought': 'npoacct'}),
re_path(r'^npoacct/', static_views.index, {'fundraiser_sought': 'npoacct'}),
path('contractpatch/', include('conservancy.contractpatch.urls')),
re_path(r'^overview', static_views.index),
re_path(r'^privacy-policy', static_views.index),
re_path(r'^overview/', static_views.index),
re_path(r'^privacy-policy/', static_views.index),
path('sustainer/', include('conservancy.supporter.urls')),
re_path(r'^coming-soon.html', static_views.index),
path('fundraiser_data/', fundgoal_views.view),
path('assignment/', include('conservancy.assignment.urls')),
re_path(r'^fossy/$', static_views.index),
re_path(r'^fossy/', static_views.index),
path('fossy/', include('conservancy.fossy.urls')),
path('casts/the-corresponding-source/', include('conservancy.podjango.urls')),
path('usethesource/', include('conservancy.usethesource.urls')),