コード例 #1
0
    def test_list_view_commercial_filter(self):
        """
        Tests Filter
        """
        self.insert_test_data()
        request = self.request_factory.get(reverse('commercial_list'),
                                           data={'name__icontains': 'Navidad'})
        request.user = self.user
        view = CommercialListView.as_view()
        response = view(request)

        self.assertEquals(response.status_code, 200)
        self.assertEquals(len(response.context_data['object_list']), 1)
コード例 #2
0
    def test_list_view_commercial_filter(self):
        """
        Tests Filter
        """
        self.insert_test_data()
        request = self.request_factory.get(reverse('commercial_list'),
                                   data={'name__icontains': 'Navidad'}
        )
        request.user = self.user
        view = CommercialListView.as_view()
        response = view(request)

        self.assertEquals(response.status_code, 200)
        self.assertEquals(len(response.context_data['object_list']), 1)
コード例 #3
0
 def test_list_view_commercial(self):
     """
     Tests List
     """
     self.insert_test_data()
     view = CommercialListView.as_view()
     request = self.request_factory.get(reverse('commercial_list'))
     request.user = self.user
     response = view(request)
     self.assertEqual(response.status_code, 200)
     self.assertEqual(len(response.context_data['object_list']), 4)
     commercial = Commercial()
     commercial.brand = Brand.objects.latest('id')
     commercial.save()
     response = view(request)
     self.assertEqual(len(response.context_data['object_list']), 5)
コード例 #4
0
 def test_list_view_commercial(self):
     """
     Tests List
     """
     self.insert_test_data()
     view = CommercialListView.as_view()
     request = self.request_factory.get(
         reverse('commercial_list')
     )
     request.user = self.user
     response = view(request)
     self.assertEqual(response.status_code, 200)
     self.assertEqual(len(response.context_data['object_list']), 4)
     commercial = Commercial()
     commercial.brand = Brand.objects.latest('id')
     commercial.save()
     response = view(request)
     self.assertEqual(len(response.context_data['object_list']), 5)
コード例 #5
0
ファイル: commercial.py プロジェクト: jonathancg90/appSpiral
from django.conf.urls import url, patterns
from apps.sp.views.panel.Commercial import CommercialListView, CommercialCreateView,\
    CommercialUpdateView, CommercialDeleteView, CommercialByBrandIdJson,\
    CommercialDataListView, CommercialCreateDataJson

urlpatterns = patterns(
    '',

    #Commercial
    url(r'^list/$', CommercialListView.as_view(), name='commercial_list'),
    url(r'^create/$', CommercialCreateView.as_view(),
        name='commercial_create'),
    url(r'^edit/(?P<pk>\d+)/$',
        CommercialUpdateView.as_view(),
        name='commercial_edit'),
    url(r'^delete/(?P<pk>\d+)/$',
        CommercialDeleteView.as_view(),
        name='commercial_delete'),
    url(r'^commercial-by-brand/(?P<brand>\d+)/$',
        CommercialByBrandIdJson.as_view(),
        name='commercial_by_brand_json'),
    url(r'^data-list/$',
        CommercialDataListView.as_view(),
        name='commercial_data_list'),
    url(r'^json-create/$',
        CommercialCreateDataJson.as_view(),
        name='commercial_json_create'),
)
コード例 #6
0
ファイル: commercial.py プロジェクト: jonathancg90/appSpiral
from django.conf.urls import url, patterns
from apps.sp.views.panel.Commercial import CommercialListView, CommercialCreateView,\
    CommercialUpdateView, CommercialDeleteView, CommercialByBrandIdJson,\
    CommercialDataListView, CommercialCreateDataJson

urlpatterns = patterns('',

     #Commercial
    url(r'^list/$',
        CommercialListView.as_view(),
        name='commercial_list'),
    url(r'^create/$',
        CommercialCreateView.as_view(),
        name='commercial_create'),
    url(r'^edit/(?P<pk>\d+)/$',
        CommercialUpdateView.as_view(),
        name='commercial_edit'),
    url(r'^delete/(?P<pk>\d+)/$',
        CommercialDeleteView.as_view(),
        name='commercial_delete'),
    url(r'^commercial-by-brand/(?P<brand>\d+)/$',
        CommercialByBrandIdJson.as_view(),
        name='commercial_by_brand_json'),
    url(r'^data-list/$',
        CommercialDataListView.as_view(),
        name='commercial_data_list'),
    url(r'^json-create/$',
        CommercialCreateDataJson.as_view(),
        name='commercial_json_create'),
)