Commit 4922e25c authored by Daniel W Bond's avatar Daniel W Bond

django2 uses 'path' instead of 'url' for urls, imported from 'django.urls'...

django2 uses 'path' instead of 'url' for urls, imported from 'django.urls' rather than 'django.conf.urls'
parent f782aa56
# standard libary imports
from __future__ import absolute_import, print_function, unicode_literals
# core django imports
from django.conf.urls import include, url
from django.urls import include, path
# third party imports
from rest_framework.routers import DefaultRouter
# imports from your apps
......
# core django imports
from django.conf.urls import url
from django.urls import path
from django.views.decorators.cache import cache_page
# imports from your apps
from .views import DetailStudent, StudentRatings, UpdateStudent
urlpatterns = [
url(r'^name-change/$',
path(r'^name-change/$',
UpdateStudent.as_view(), name='name_change'),
url(r'^(?P<slug>[\w-]+)/$',
path(r'^(?P<slug>[\w-]+)/$',
cache_page(6)(DetailStudent.as_view()), name='profile'),
url(r'^(?P<slug>[\w-]+)/ratings/$',
path(r'^(?P<slug>[\w-]+)/ratings/$',
cache_page(6)(StudentRatings.as_view()), name='ratings'),
]
# core django imports
from django.conf.urls import url
from django.urls import path
from django.views.decorators.cache import cache_page
# imports from your apps
from .views import DetailLookout, CreateLookout, DeleteLookout
urlpatterns = [
url(r'^new/$',
path(r'^new/$',
CreateLookout.as_view(), name='create_lookout'),
url(r'^(?P<slug>[\w-]+)/$',
path(r'^(?P<slug>[\w-]+)/$',
cache_page(60 * 2)(DetailLookout.as_view()), name='detail_lookout'),
url(r'^(?P<slug>[\w-]+)/delete/$',
path(r'^(?P<slug>[\w-]+)/delete/$',
DeleteLookout.as_view(), name='delete_lookout'),
]
# core django imports
from django.conf.urls import url
from django.urls import path
from django.views.decorators.cache import cache_page
# imports from your apps
from .views import ModLandingView, FlagModView, ListingNumModView,\
UserEmailRatioModView
urlpatterns = [
url(r'^$', cache_page(60 * 15)(ModLandingView.as_view()), name='mod_page'),
path(r'^$', cache_page(60 * 15)(ModLandingView.as_view()), name='mod_page'),
url(r'^flags/$', FlagModView.as_view(), name='flag_mod'),
path(r'^flags/$', FlagModView.as_view(), name='flag_mod'),
url(r'^listing-nums/$', ListingNumModView.as_view(), name='listing_nums'),
path(r'^listing-nums/$', ListingNumModView.as_view(), name='listing_nums'),
url(r'^email-ratio/$', UserEmailRatioModView.as_view(), name='email_ratio'),
path(r'^email-ratio/$', UserEmailRatioModView.as_view(), name='email_ratio'),
]
# core django imports
from django.conf.urls import include, url
from django.urls import include, path
from django.views.generic import TemplateView
from django.conf.urls.static import static
from django.conf import settings
......@@ -23,42 +23,42 @@ handle500 = TemplateView.as_view(template_name="500.html")
urlpatterns = [
# app-level urls
url(r'^share/', include('trades.urls')),
url(r'^student/', include('core.urls')),
url(r'^lookouts/', include('lookouts.urls')),
url(r'^mod/', include('mod.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')),
# search
url(r'^search/', login_required(SearchView(form_class=ListingSearchForm),
login_url='login'), name='search'),
path(r'^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
url(r'^$', HomepageView.as_view(), name='homepage'),
url(r'^charts/?$', ChartsView.as_view(), name='charts'),
path(r'^$', HomepageView.as_view(), name='homepage'),
path(r'^charts/?$', ChartsView.as_view(), name='charts'),
# static pages
url(r'^about/?$',
path(r'^about/?$',
cache_page(60 * 15)(TemplateView.as_view(template_name='about.html')),
name='about'),
url(r'^privacy/?$',
path(r'^privacy/?$',
cache_page(60 * 15)(TemplateView.as_view(template_name='privacy.html')),
name='privacy'),
# user authentication
url(r'^login/$', login, name='login'),
url(r'^logout/$', logout, name='logout'),
path(r'^login/$', login, name='login'),
path(r'^logout/$', logout, name='logout'),
# admin pages
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
path(r'^admin/doc/', include('django.contrib.admindocs.urls')),
path(r'^admin/', include(admin.site.urls)),
# api
url(r'^api/v1/', include('api.urls')),
path(r'^api/v1/', include('api.urls')),
# establishing versioning already so we easily can move to another API release
# without specific version redirects to latest version
url(r'^api/$', RedirectView.as_view(url="v1/")),
path(r'^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)
# core django imports
from django.conf.urls import url
from django.urls import path
from django.views.decorators.cache import cache_page
# imports from your apps
from .views import ListListings, CreateListing, ListingPage,\
......@@ -10,55 +10,55 @@ from .views import ListListings, CreateListing, ListingPage,\
urlpatterns = [
url(r'^all/$',
path(r'^all/$',
cache_page(60 * 2)(ListListings.as_view()), name='list_listings'),
url(r'^new/$',
path(r'^new/$',
CreateListing.as_view(), name='create_listing'),
url(r'^listing/(?P<slug>[\w-]+)/$',
cache_page(4)(ListingPage.as_view()), name='detail_listing'),
path(r'^listing/(?P<slug>[\w-]+)/$',
cache_page(4)(ListingPage.as_view()), name='detail_listing'),
url(r'^listing/(?P<slug>[\w-]+)/delete/$',
path(r'^listing/(?P<slug>[\w-]+)/delete/$',
DeleteListing.as_view(), name='delete_listing'),
url(r'^listing/(?P<listing_slug>[\w-]+)/bid/(?P<slug>[\w-]+)/edit/$',
path(r'^listing/(?P<listing_slug>[\w-]+)/bid/(?P<slug>[\w-]+)/edit/$',
EditBid.as_view(), name='edit_bid'),
url(r'^listing/(?P<slug>[\w-]+)/flag/$',
path(r'^listing/(?P<slug>[\w-]+)/flag/$',
CreateFlag.as_view(), name='create_flag'),
url(r'^listing/(?P<listing_slug>[\w-]+)/flag/(?P<slug>[\w-]+)/remove/$',
path(r'^listing/(?P<listing_slug>[\w-]+)/flag/(?P<slug>[\w-]+)/remove/$',
DeleteFlag.as_view(), name='delete_flag'),
url(r'^listing/(?P<listing_slug>[\w-]+)/bid/(?P<slug>[\w-]+)/flag/$',
path(r'^listing/(?P<listing_slug>[\w-]+)/bid/(?P<slug>[\w-]+)/flag/$',
CreateBidFlag.as_view(), name='create_bid_flag'),
url(r'^listing/(?P<listing_slug>[\w-]+)/bid/(?P<bid_slug>[\w-]+)/flag/(?P<slug>[\w-]+)/remove/$',
path(r'^listing/(?P<listing_slug>[\w-]+)/bid/(?P<bid_slug>[\w-]+)/flag/(?P<slug>[\w-]+)/remove/$',
DeleteBidFlag.as_view(), name='delete_bid_flag'),
url(r'^listing/(?P<slug>[\w-]+)/edit/$',
path(r'^listing/(?P<slug>[\w-]+)/edit/$',
EditListing.as_view(), name='edit_listing'),
url(r'^listing/(?P<slug>[\w-]+)/exchange/$',
path(r'^listing/(?P<slug>[\w-]+)/exchange/$',
ExchangeListing.as_view(), name='exchange_listing'),
url(r'^listing/(?P<slug>[\w-]+)/unexchange/$',
path(r'^listing/(?P<slug>[\w-]+)/unexchange/$',
UnExchangeListing.as_view(), name='unexchange_listing'),
url(r'^listing/(?P<slug>[\w-]+)/cancel/$',
path(r'^listing/(?P<slug>[\w-]+)/cancel/$',
CancelListing.as_view(), name='cancel_listing'),
url(r'^listing/(?P<slug>[\w-]+)/reopen/$',
path(r'^listing/(?P<slug>[\w-]+)/reopen/$',
ReopenListing.as_view(), name='reopen_listing'),
url(r'^listing/(?P<slug>[\w-]+)/rate/$',
path(r'^listing/(?P<slug>[\w-]+)/rate/$',
CreateRating.as_view(), name='create_rating'),
url(r'^listing/(?P<listing_slug>[\w-]+)/rating/(?P<slug>[\w-]+)/edit/$',
path(r'^listing/(?P<listing_slug>[\w-]+)/rating/(?P<slug>[\w-]+)/edit/$',
EditRating.as_view(), name='edit_rating'),
url(r'^listing/(?P<listing_slug>[\w-]+)/rating/(?P<slug>[\w-]+)/remove/$',
path(r'^listing/(?P<listing_slug>[\w-]+)/rating/(?P<slug>[\w-]+)/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