Commit 1cc6bba2 authored by Daniel W Bond's avatar Daniel W Bond

django2 gives you simplified fake regex for urls

parent b419afc4
......@@ -5,12 +5,12 @@ from django.views.decorators.cache import cache_page
from .views import DetailStudent, StudentRatings, UpdateStudent
urlpatterns = [
path(r'^name-change/$',
path('name-change/',
UpdateStudent.as_view(), name='name_change'),
path(r'^(?P<slug>[\w-]+)/$',
path('<slug>/',
cache_page(6)(DetailStudent.as_view()), name='profile'),
path(r'^(?P<slug>[\w-]+)/ratings/$',
path('<slug>/ratings/',
cache_page(6)(StudentRatings.as_view()), name='ratings'),
]
......@@ -6,12 +6,12 @@ from .views import DetailLookout, CreateLookout, DeleteLookout
urlpatterns = [
path(r'^new/$',
path('new/',
CreateLookout.as_view(), name='create_lookout'),
path(r'^(?P<slug>[\w-]+)/$',
path('<slug>/',
cache_page(60 * 2)(DetailLookout.as_view()), name='detail_lookout'),
path(r'^(?P<slug>[\w-]+)/delete/$',
path('<slug>/delete/',
DeleteLookout.as_view(), name='delete_lookout'),
]
......@@ -6,12 +6,12 @@ from .views import ModLandingView, FlagModView, ListingNumModView,\
UserEmailRatioModView
urlpatterns = [
path(r'^$', cache_page(60 * 15)(ModLandingView.as_view()), name='mod_page'),
path('', cache_page(60 * 15)(ModLandingView.as_view()), name='mod_page'),
path(r'^flags/$', FlagModView.as_view(), name='flag_mod'),
path('flags/', FlagModView.as_view(), name='flag_mod'),
path(r'^listing-nums/$', ListingNumModView.as_view(), name='listing_nums'),
path('listing-nums/', ListingNumModView.as_view(), name='listing_nums'),
path(r'^email-ratio/$', UserEmailRatioModView.as_view(), name='email_ratio'),
path('email-ratio/', UserEmailRatioModView.as_view(), name='email_ratio'),
]
......@@ -23,42 +23,42 @@ handle500 = TemplateView.as_view(template_name="500.html")
urlpatterns = [
# app-level urls
path(r'^share/', include('trades.urls')),
path(r'^student/', include('core.urls')),
path(r'^lookouts/', include('lookouts.urls')),
path(r'^mod/', include('mod.urls')),
path('share/', include('trades.urls')),
path('student/', include('core.urls')),
path('lookouts/', include('lookouts.urls')),
path('mod/', include('mod.urls')),
# search
path(r'^search/', login_required(SearchView(form_class=ListingSearchForm),
login_url='login'), name='search'),
path('search/', login_required(SearchView(form_class=ListingSearchForm),
login_url='login'), name='search'),
# site-wide pages
# homepage is weird for cacheing... no special url, but different content
# for each user
path(r'^$', HomepageView.as_view(), name='homepage'),
path(r'^charts/?$', ChartsView.as_view(), name='charts'),
path('', HomepageView.as_view(), name='homepage'),
path('charts/', ChartsView.as_view(), name='charts'),
# static pages
path(r'^about/?$',
path('about/',
cache_page(60 * 15)(TemplateView.as_view(template_name='about.html')),
name='about'),
path(r'^privacy/?$',
path('privacy/',
cache_page(60 * 15)(TemplateView.as_view(template_name='privacy.html')),
name='privacy'),
# user authentication
path(r'^login/$', login, name='login'),
path(r'^logout/$', logout, name='logout'),
path('login/', login, name='login'),
path('logout/', logout, name='logout'),
# admin pages
path(r'^admin/doc/', include('django.contrib.admindocs.urls')),
path(r'^admin/', admin.site.urls),
path('admin/doc/', include('django.contrib.admindocs.urls')),
path('admin/', admin.site.urls),
# api
path(r'^api/v1/', include('api.urls')),
path('api/v1/', include('api.urls')),
# establishing versioning already so we easily can move to another API release
# without specific version redirects to latest version
path(r'^api/$', RedirectView.as_view(url="v1/")),
path('api/', RedirectView.as_view(url="v1/")),
# location of user-uploaded media files from settings.py (for local)
] #+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
......@@ -10,55 +10,55 @@ from .views import ListListings, CreateListing, ListingPage,\
urlpatterns = [
path(r'^all/$',
path('all/',
cache_page(60 * 2)(ListListings.as_view()), name='list_listings'),
path(r'^new/$',
path('new/',
CreateListing.as_view(), name='create_listing'),
path(r'^listing/(?P<slug>[\w-]+)/$',
path('listing/<slug>/',
cache_page(4)(ListingPage.as_view()), name='detail_listing'),
path(r'^listing/(?P<slug>[\w-]+)/delete/$',
path('listing/<slug>/delete/',
DeleteListing.as_view(), name='delete_listing'),
path(r'^listing/(?P<listing_slug>[\w-]+)/bid/(?P<slug>[\w-]+)/edit/$',
path('listing/<listing_slug>/bid/<slug>/edit/',
EditBid.as_view(), name='edit_bid'),
path(r'^listing/(?P<slug>[\w-]+)/flag/$',
path('listing/<slug>/flag/',
CreateFlag.as_view(), name='create_flag'),
path(r'^listing/(?P<listing_slug>[\w-]+)/flag/(?P<slug>[\w-]+)/remove/$',
path('listing/<listing_slug>/flag/<slug>/remove/',
DeleteFlag.as_view(), name='delete_flag'),
path(r'^listing/(?P<listing_slug>[\w-]+)/bid/(?P<slug>[\w-]+)/flag/$',
path('listing/<listing_slug>/bid/<slug>/flag/',
CreateBidFlag.as_view(), name='create_bid_flag'),
path(r'^listing/(?P<listing_slug>[\w-]+)/bid/(?P<bid_slug>[\w-]+)/flag/(?P<slug>[\w-]+)/remove/$',
path('listing/<listing_slug>/bid/<bid_slug>/flag/<slug>/remove/',
DeleteBidFlag.as_view(), name='delete_bid_flag'),
path(r'^listing/(?P<slug>[\w-]+)/edit/$',
path('listing/<slug>/edit/',
EditListing.as_view(), name='edit_listing'),
path(r'^listing/(?P<slug>[\w-]+)/exchange/$',
path('listing/<slug>/exchange/',
ExchangeListing.as_view(), name='exchange_listing'),
path(r'^listing/(?P<slug>[\w-]+)/unexchange/$',
path('listing/<slug>/unexchange/',
UnExchangeListing.as_view(), name='unexchange_listing'),
path(r'^listing/(?P<slug>[\w-]+)/cancel/$',
path('listing/<slug>/cancel/',
CancelListing.as_view(), name='cancel_listing'),
path(r'^listing/(?P<slug>[\w-]+)/reopen/$',
path('listing/<slug>/reopen/',
ReopenListing.as_view(), name='reopen_listing'),
path(r'^listing/(?P<slug>[\w-]+)/rate/$',
path('listing/<slug>/rate/',
CreateRating.as_view(), name='create_rating'),
path(r'^listing/(?P<listing_slug>[\w-]+)/rating/(?P<slug>[\w-]+)/edit/$',
path('listing/<listing_slug>/rating/<slug>/edit/',
EditRating.as_view(), name='edit_rating'),
path(r'^listing/(?P<listing_slug>[\w-]+)/rating/(?P<slug>[\w-]+)/remove/$',
path('listing/<listing_slug>/rating/<slug>/remove/',
DeleteRating.as_view(), name='delete_rating'),
]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment