from django.conf.urls import patterns, url
from django.contrib.admin.views.decorators import staff_member_required

from oscar.core.application import Application

from . import views


class SagepayDashboard(Application):
    name = None
    list_view = views.Transactions
    detail_view = views.Transaction

    def get_urls(self):
        urlpatterns = patterns('',
            url(r'^transactions/$', self.list_view.as_view(),
                name='sagepay-transaction-list'),
            url(r'^transactions/(?P<pk>\d+)/$', self.detail_view.as_view(),
                name='sagepay-transaction-detail'),
        )
        return self.post_process_urls(urlpatterns)

    def get_url_decorator(self, url_name):
        return staff_member_required


application = SagepayDashboard()

from django.conf.urls import patterns, url
from django.contrib.admin.views.decorators import staff_member_required

from oscar.core.application import Application
from oscar.apps.dashboard.nav import register, Node

from . import views

node = Node('Datacash', 'sagepay-transaction-list')
register(node, 100)


class SagepayDashboard(Application):
    name = None
    list_view = views.Transactions
    detail_view = views.Transaction

    def get_urls(self):
        urlpatterns = patterns('',
            url(r'^transactions/$', self.list_view.as_view(),
                name='sagepay-transaction-list'),
            url(r'^transactions/(?P<pk>\d+)/$', self.detail_view.as_view(),
                name='sagepay-transaction-detail'),
        )
        return self.post_process_urls(urlpatterns)

    def get_url_decorator(self, url_name):
        return staff_member_required


application = SagepayDashboard()

Add dashboard node for transaction list
Add dashboard node for transaction list

  from django.conf.urls import patterns, url
  from django.contrib.admin.views.decorators import staff_member_required
  
  from oscar.core.application import Application
+ from oscar.apps.dashboard.nav import register, Node
  
  from . import views
+ 
+ node = Node('Datacash', 'sagepay-transaction-list')
+ register(node, 100)
  
  
  class SagepayDashboard(Application):
      name = None
      list_view = views.Transactions
      detail_view = views.Transaction
  
      def get_urls(self):
          urlpatterns = patterns('',
              url(r'^transactions/$', self.list_view.as_view(),
                  name='sagepay-transaction-list'),
              url(r'^transactions/(?P<pk>\d+)/$', self.detail_view.as_view(),
                  name='sagepay-transaction-detail'),
          )
          return self.post_process_urls(urlpatterns)
  
      def get_url_decorator(self, url_name):
          return staff_member_required
  
  
  application = SagepayDashboard()
  
Add dashboard node for transaction list
## Code Before:
from django.conf.urls import patterns, url
from django.contrib.admin.views.decorators import staff_member_required

from oscar.core.application import Application

from . import views


class SagepayDashboard(Application):
    name = None
    list_view = views.Transactions
    detail_view = views.Transaction

    def get_urls(self):
        urlpatterns = patterns('',
            url(r'^transactions/$', self.list_view.as_view(),
                name='sagepay-transaction-list'),
            url(r'^transactions/(?P<pk>\d+)/$', self.detail_view.as_view(),
                name='sagepay-transaction-detail'),
        )
        return self.post_process_urls(urlpatterns)

    def get_url_decorator(self, url_name):
        return staff_member_required


application = SagepayDashboard()

## Instruction:
Add dashboard node for transaction list
## Code After:
from django.conf.urls import patterns, url
from django.contrib.admin.views.decorators import staff_member_required

from oscar.core.application import Application
from oscar.apps.dashboard.nav import register, Node

from . import views

node = Node('Datacash', 'sagepay-transaction-list')
register(node, 100)


class SagepayDashboard(Application):
    name = None
    list_view = views.Transactions
    detail_view = views.Transaction

    def get_urls(self):
        urlpatterns = patterns('',
            url(r'^transactions/$', self.list_view.as_view(),
                name='sagepay-transaction-list'),
            url(r'^transactions/(?P<pk>\d+)/$', self.detail_view.as_view(),
                name='sagepay-transaction-detail'),
        )
        return self.post_process_urls(urlpatterns)

    def get_url_decorator(self, url_name):
        return staff_member_required


application = SagepayDashboard()
