def test_create_view_commercial(self): """ Tests Create """ self.insert_test_data() self.assertEqual(Commercial.objects.all().count(), 4) data = { 'name': 'Commercial test', 'brand': Brand.objects.filter(name='Sprite')[0].id, 'id_realized': '02/07/2014' } view = CommercialCreateView.as_view() request = self.request_factory.post(reverse('commercial_create'), data) request.user = self.user response = view(request) self.assertEqual(response.status_code, 302) self.assertEqual(Commercial.objects.all().count(), 5) self.assertEqual(CommercialDateDetail.objects.all().count(), 1)
def test_create_view_commercial(self): """ Tests Create """ self.insert_test_data() self.assertEqual(Commercial.objects.all().count(), 4) data = { 'name': 'Commercial test', 'brand': Brand.objects.filter(name='Sprite')[0].id, 'id_realized': '02/07/2014' } view = CommercialCreateView.as_view() request = self.request_factory.post( reverse('commercial_create'), data ) request.user = self.user response = view(request) self.assertEqual(response.status_code, 302) self.assertEqual(Commercial.objects.all().count(), 5) self.assertEqual(CommercialDateDetail.objects.all().count(), 1)
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'), )