Changeset - 33833e3a3390
[Not reviewed]
0 4 0
Ben Sturmfels (bsturmfels) - 1 month ago 2024-03-18 07:38:30
ben@sturm.com.au
Convert remaining `url` routes to `path`/`re_path`
4 files changed with 29 insertions and 34 deletions:
0 comments (0 inline, 0 general)
conservancy/blog/urls.py
Show inline comments
 
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
 
from .views import (
 
    BlogDateDetailView,
 
    BlogDayArchiveView,
...
 
@@ -20,18 +20,18 @@ info_dict = {
 
    'queryset': Entry.objects.all(),
 
    'date_field': 'pub_date',
 
    'extra_context': extra_context,
 
}
 

	
 
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
 

	
 
def all_tags_by_use_amount():
 
    """Returns all tags with an added 'cnt' attribute (how many times used)
conservancy/news/urls.py
Show inline comments
...
 
@@ -15,13 +15,13 @@
 
#
 
# You should have received a copy of the GNU Affero General Public License
 
# along with this program in a file in the toplevel directory called
 
# "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 (
 
    NewsDateDetailView,
 
    NewsDayArchiveView,
 
    NewsMonthArchiveView,
...
 
@@ -36,12 +36,12 @@ info_dict = {
 

	
 
external_article_dict = {
 
    'articles': ExternalArticle.objects.all()
 
}
 

	
 
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)),
 
]
conservancy/supporter/urls.py
Show inline comments
 
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))
conservancy/urls.py
Show inline comments
...
 
@@ -25,38 +25,37 @@ from .fundgoal import views as fundgoal_views
 
from . import views as static_views
 

	
 
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),
 
    path('feeds/blog/', feeds.BlogFeed()),
 
    path('feeds/news/', feeds.PressReleaseFeed()),
 
    path('feeds/omnibus/', feeds.OmnibusFeed()),
 
    path('feeds/', feeds.view),
 
    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')),
 
]
0 comments (0 inline, 0 general)