def test_data_list(self): """ Tests List """ self.insert_test_data() view = CommercialDataListView.as_view() request = self.request_factory.get(reverse('commercial_data_list')) request.user = self.user response = view(request) self.assertEqual(response.status_code, 200) content = json.loads(response._container[0]) self.assertEqual(len(content.get('commercial')), 4) commercial = Commercial() commercial.brand = Brand.objects.latest('id') commercial.save() response = view(request) content = json.loads(response._container[0]) self.assertEqual(len(content.get('commercial')), 5)
def test_data_list(self): """ Tests List """ self.insert_test_data() view = CommercialDataListView.as_view() request = self.request_factory.get( reverse('commercial_data_list') ) request.user = self.user response = view(request) self.assertEqual(response.status_code, 200) content = json.loads(response._container[0]) self.assertEqual(len( content.get('commercial')), 4) commercial = Commercial() commercial.brand = Brand.objects.latest('id') commercial.save() response = view(request) content = json.loads(response._container[0]) self.assertEqual(len( content.get('commercial')), 5)
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'), )
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'), )