from django.conf.urls import patterns, url from oscar.views.decorators import staff_member_required from oscar.core.application import Application from oscar.apps.dashboard.orders import views class OrdersDashboardApplication(Application): name = None order_list_view = views.OrderListView order_detail_view = views.OrderDetailView shipping_address_view = views.ShippingAddressUpdateView line_detail_view = views.LineDetailView order_stats_view = views.OrderStatsView def get_urls(self): urlpatterns = patterns('', url(r'^$', self.order_list_view.as_view(), name='order-list'), url(r'^statistics/$', self.order_stats_view.as_view(), name='order-stats'), url(r'^(?P[-\w]+)/$', self.order_detail_view.as_view(), name='order-detail'), url(r'^(?P[-\w]+)/notes/(?P\d+)/$', self.order_detail_view.as_view(), name='order-detail-note'), url(r'^(?P[-\w]+)/lines/(?P\d+)/$', self.line_detail_view.as_view(), name='order-line-detail'), url(r'^(?P[-\w]+)/shipping-address/$', self.shipping_address_view.as_view(), name='order-shipping-address'), ) return self.post_process_urls(urlpatterns) def get_url_decorator(self, url_name): return staff_member_required application = OrdersDashboardApplication()