Example #1
0
    def test_delete_view_brand(self):
        """
        Tests data: Delete
        """
        self.insert_test_data()
        self.assertEqual(Commercial.objects.all().count(), 4)
        commercial = Commercial.objects.get(pk=1)

        kwargs = {'pk': commercial.id}
        url = reverse('commercial_delete', kwargs=kwargs)
        request = self.request_factory.post(url, kwargs)
        request.user = self.user
        response = CommercialDeleteView.as_view()(request, **kwargs)
        self.assertEqual(response.status_code, 302)
        self.assertEqual(Commercial.objects.all().count(), 3)
Example #2
0
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'),
)