Пример #1
0
    def test_delete_features(self):
        model = Model.objects.latest('created')
        model_feature_detail = ModelFeatureDetail()
        model_feature_detail.model = model
        model_feature_detail.feature_value = FeatureValue.objects.get(pk=139)
        model_feature_detail.description = 'Facebook'
        model_feature_detail.save()
        self.assertEqual(model.model_feature_detail_set.all().count(), 2)

        url = reverse('panel_model_delete_feature')
        data = str(model_feature_detail.id)
        view = ModelFeatureDeleteView.as_view()
        request = self.request_factory.post(url,
                                            data=dumps(data),
                                            content_type='application/json')
        request.user = self.user
        response = view(request)
        content = json.loads(response._container[0])
        self.assertEqual(content.get('status'), 'success')
        self.assertEqual(model.model_feature_detail_set.all().count(), 1)
Пример #2
0
    def test_delete_features(self):
        model = Model.objects.latest('created')
        model_feature_detail = ModelFeatureDetail()
        model_feature_detail.model = model
        model_feature_detail.feature_value = FeatureValue.objects.get(pk=139)
        model_feature_detail.description = 'Facebook'
        model_feature_detail.save()
        self.assertEqual(model.model_feature_detail_set.all().count(), 2)

        url = reverse('panel_model_delete_feature')
        data = str(model_feature_detail.id)
        view = ModelFeatureDeleteView.as_view()
        request = self.request_factory.post(
            url, data=dumps(data), content_type='application/json'
        )
        request.user = self.user
        response = view(request)
        content = json.loads(response._container[0])
        self.assertEqual(content.get('status'), 'success')
        self.assertEqual(model.model_feature_detail_set.all().count(), 1)
Пример #3
0
    url(r'^model-control/save-profile/$',
        ModelCreateView.as_view(),
        name='panel_model_save_profile'),
    url(r'^model-control/update-profile/(?P<pk>[^/]+)/$',
        ModelUpdateView.as_view(),
        name='panel_model_update_profile'),
    url(r'^model-control/quick-update/$',
        QuickModelUpdateView.as_view(),
        name='quick_update_url'),
    url(r'^model-control/save-feature/(?P<pk>[^/]+)/$',
        ModelFeatureCreateView.as_view(),
        name='panel_model_save_feature'),
    url(r'^model-control/update-feature/(?P<pk>[^/]+)/$',
        ModelFeatureUpdateView.as_view(),
        name='panel_model_update_feature'),
    url(r'^model-control/delete-picture/(?P<pk>[^/]+)/$',
        DeleteImageModelView.as_view(),
        name='panel_model_delete_picture'),
    url(r'^model-control/delete-feature/$',
        ModelFeatureDeleteView.as_view(),
        name='panel_model_delete_feature'),
    url(r'^model-control/information/(?P<pk>[^/]+)/$',
        ModelDataJsonView.as_view(),
        name='panel_information_model'),
    url(r'^model-control/save-picture/$',
        PictureModelCreateView.as_view(),
        name='panel_model_save_picture'),
    url(r'^model-control/simple-search/$',
        ModelSimpleSearchView.as_view(),
        name='simple_search_model'),
)
Пример #4
0
        QuickModelUpdateView.as_view(),
        name='quick_update_url'),

    url(r'^model-control/save-feature/(?P<pk>[^/]+)/$',
        ModelFeatureCreateView.as_view(),
        name='panel_model_save_feature'),

    url(r'^model-control/update-feature/(?P<pk>[^/]+)/$',
        ModelFeatureUpdateView.as_view(),
        name='panel_model_update_feature'),

    url(r'^model-control/delete-picture/(?P<pk>[^/]+)/$',
        DeleteImageModelView.as_view(),
        name='panel_model_delete_picture'),

    url(r'^model-control/delete-feature/$',
        ModelFeatureDeleteView.as_view(),
        name='panel_model_delete_feature'),

    url(r'^model-control/information/(?P<pk>[^/]+)/$',
        ModelDataJsonView.as_view(),
        name='panel_information_model'),

    url(r'^model-control/save-picture/$',
        PictureModelCreateView.as_view(),
        name='panel_model_save_picture'),

    url(r'^model-control/simple-search/$',
        ModelSimpleSearchView.as_view(),
        name='simple_search_model'),
)