def test_orders_detail(self): """test for orders detail url""" url = reverse('orders:orders-detail', kwargs={'pk': 1}) self.assertEqual( resolve(url).func.__name__, OrderView.as_view({ 'get': 'retrieve' }).__name__)
def test_orders_list(self): """test for orders list url""" url = reverse('orders:orders-list') self.assertEqual( resolve(url).func.__name__, OrderView.as_view({ 'get': 'list' }).__name__)
from django.conf.urls import url from orders.views import OrderView, TureorderView, Pay, Notify urlpatterns = [ url(r'^order/$', OrderView.as_view(), name='确认支付'), url(r'^tureorder/$', TureorderView.as_view(), name='确认订单'), url(r'^pay/$', Pay.as_view(), name='支付结果'), url(r'^notify/$', Notify.as_view(), name='后台支付通知'), ]
"""untitled URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.conf.urls import url from django.contrib import admin from django.urls import path from orders.views import OrderView urlpatterns = [ path('admin/', admin.site.urls), url(r'create_orders$', OrderView.as_view(), name='create_orders'), ]
from orders.views import ( OrderView, UserOrderView, ) from profiles.views import ( ProfileView, ) urlpatterns = [ url(r'^about/$', function_based_view), url(r'^article/(?P<slug>[\w-]+)/$', ArticleView.as_view()), url(r'^blog/(?P<year>\d{4})/$', YearArchiveView.as_view()), url(r'^blog/(?P<year>\d{4})/(?P<month>\d{2})/$', YearArchiveView.as_view()), url(r"^order/(?P<order>\d+)/$", OrderView.as_view()), url(r"^order/(?P<username>[\w.@+-]+)/(?P<order>\d+)/$", UserOrderView.as_view()), url(r'^profile/(?P<username>[\w.@+-]+)/$', ProfileView.as_view()), ] """ Django 1.5-1.8 Pattern Syntax """ from blog.views import ( ArticleView, YearArchiveView, MonthArchiveView, PostSlugView, PostIdView,
1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from django.conf import settings from django.conf.urls.static import static from users.views import index from users.views import LoginView, RegisterView, UpdataUserView, userLogout from orders.views import OrderView, delete_order from goods.views import ProductsView urlpatterns = [ path('admin/', admin.site.urls), path('', index, name='index'), path('login/', LoginView.as_view(), name='login'), path('logout/', userLogout, name='logout'), path('register/', RegisterView.as_view(), name='register'), path('orders/', OrderView.as_view(), name='orders'), path('updateuser/', UpdataUserView.as_view(), name='updateuser'), path('products/', ProductsView.as_view(), name='products'), path('deleteorder/', delete_order, name='deleteorder') ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.conf.urls import patterns, include, url from orders.views import OrderView, success from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'ezmeds.views.home', name='home'), # url(r'^ezmeds/', include('ezmeds.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), url(r'^$', OrderView.as_view(), name='home'), url(r'^success/$', success, name='success'), )
from django.conf.urls import patterns, include, url from django.views.generic import DetailView, ListView from schedules.models import CourseSchedule from orders.views import OrderView, HomeView from schedules.views import ScheduleView urlpatterns = patterns('', # url(r'^$', views.index, name='index'), # url(r'^(?P<courses_id>\d+)/$', views.detail, name='detail'), url(r'^$', ListView.as_view( queryset=CourseSchedule.objects.order_by('-start_date')[:5], context_object_name='latest_scheduled_courses_list', template_name='schedules/index.html'), name='index'), url(r'^(?P<pk>\d+)/$', ScheduleView, name='detail'), url(r'^(?P<pk>\d+)/focus/(?P<focus>\d+)/$', ScheduleView, name='detail'), url(r'^(?P<pk>\d+)/order/$', HomeView, name='index'), url(r'^(?P<key>\d+)/order/(?P<pk>\d+)/$', OrderView.as_view(), name='detail'), )
categories_list = CategoriesView.as_view({'get': 'list'}) app_name = 'orders' urlpatterns = [ path('partner/loadinfo', LoadInfo.as_view(), name='partner-update'), path('partner/state', StateChange.as_view(), name='partner-state'), path('partner/orders', ShopOrders.as_view(), name='partner-orders'), path('user/register', RegisterView.as_view(), name='user-register'), path('user/register/confirm', ConfirmAccountView.as_view(), name='user-register-confirm'), path('user/details', UserView.as_view(), name='user-details'), path('user/contact', ContactView.as_view(), name='user-contact'), path('user/login', LoginView.as_view(), name='user-login'), path('user/password_reset', PasswordResetView.as_view(), name='password-reset'), path('user/password_reset/confirm', PasswordConfirmView.as_view(), name='password-reset-confirm'), path('categories', categories_list, name='categories'), path('shops', shops_list, name='shops'), path('products', ProductsView.as_view(), name='products'), path('product_info/<int:product_id>/', ProductInfoView.as_view(), name='product_info'), path('cart', CartView.as_view(), name='cart'), path('order', OrderView.as_view(), name='order'), path('orders', OrdersView.as_view(), name='orders'), ]
from django.conf.urls import url, include from django.contrib import admin from django.views.decorators.csrf import csrf_exempt from orders.views import OrderView urlpatterns = [url(r'^$', OrderView.as_view())]
from django.urls import include, path from orders.views import OrderView urlpatterns = [ path("order/<int:pk>/", OrderView.as_view(), name="order_detail"), path("payments/", include("getpaid.urls")), path("paywall/", include("paywall.urls")), ]
""" from django.contrib import admin from django.contrib.auth.views import LoginView, LogoutView from django.urls import path, re_path from orders.views import CartView, SubOrderView, PizzaOrderView, PastaOrderView, SaladOrderView, DinnerOrderView, \ ProductDeleteView, ProductUpdateView, ConfirmationView, OrderView from orders import views as order_views from accounts.views import RegistrationView from pizza.views import IndexView urlpatterns = [ path('admin/', admin.site.urls), path('login/', LoginView.as_view(template_name='accounts/login.html'), name='login'), path('logout/', LogoutView.as_view(), name='logout'), path('register/', RegistrationView.as_view(), name='registration'), path('order/pizza', PizzaOrderView.as_view(), name='pizza_order'), path('order/sub', SubOrderView.as_view(), name='sub_order'), path('order/pasta', PastaOrderView.as_view(), name='pasta_order'), path('order/salad', SaladOrderView.as_view(), name='salad_order'), path('order/dinner', DinnerOrderView.as_view(), name='dinner_order'), path('check/price', order_views.check_price, name='check_price'), path('cart', CartView.as_view(), name='cart'), path('confirmation', ConfirmationView.as_view(), name='confirmation'), path('orders', OrderView.as_view(), name='order_list'), path('delete/<int:pk>', ProductDeleteView.as_view(), name='delete_product'), path('update/<int:pk>', ProductUpdateView.as_view(), name='update_product'), re_path('^$', IndexView.as_view(), name='index'), ]
from django.conf.urls.defaults import patterns, url from orders.views import OrderView, AddItemView, RemoveItemView urlpatterns = patterns('', url(r'^add/$', AddItemView.as_view(), name='add-item'), url(r'^remove/(?P<content_type>\d+)/(?P<object_id>\d+)/$', RemoveItemView.as_view(), name='remove-item'), url(r'$^', OrderView.as_view(), name='review'), )
from django.urls import path from orders.views import ( OrderView, TopProductView ) app_name = 'orders' urlpatterns = [ path('sells/', TopProductView.as_view()), path('order/', OrderView.as_view()), ]
from django.contrib import admin from django.urls import include, re_path from orders.views import HomeView, OrderView app_name = "getpaid_example" urlpatterns = [ re_path(r"^admin/", admin.site.urls), re_path(r"^$", HomeView.as_view(), name="home"), re_path(r"^order/(?P<pk>\d+)/$", OrderView.as_view(), name="order_detail"), re_path(r"^payments/", include("getpaid.urls")), ]
from django.conf.urls import url from orders.views import OrderView, CartView, CartCheckoutView urlpatterns = [ url(r'^orders/', OrderView.as_view()), url(r'^cart/', CartView.as_view()), url(r'^cart/addproduct/', CartView.as_view()), url(r'^cart/removeproduct/', CartView.as_view()), url(r'^order-checkout/', CartCheckoutView.as_view()), ]
"""example URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url, include from django.contrib import admin from orders.views import HomeView, OrderView app_name = 'getpaid_example' urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', HomeView.as_view(), name='home'), url(r'^order/(?P<pk>\d+)/$', OrderView.as_view(), name='order_detail'), url(r'', include('getpaid.urls', namespace='getpaid')), ]
from django.conf.urls.defaults import patterns, url from orders.views import OrderView, AddItemView, RemoveItemView urlpatterns = patterns( '', url(r'^add/$', AddItemView.as_view(), name='add-item'), url(r'^remove/(?P<content_type>\d+)/(?P<object_id>\d+)/$', RemoveItemView.as_view(), name='remove-item'), url(r'$^', OrderView.as_view(), name='review'), )