Пример #1
0
 def test_save_features(self):
     model = Model.objects.latest('created')
     self.assertEqual(model.model_feature_detail_set.all().count(), 1)
     url = reverse('panel_model_save_feature', kwargs={'pk': model.id})
     data = {"feature_value": {"value_id": 138, "value_name": "Facebook"}}
     view = ModelFeatureCreateView.as_view()
     request = self.request_factory.post(url,
                                         data=dumps(data),
                                         content_type='application/json')
     request.user = self.user
     response = view(request, pk=model.id)
     content = json.loads(response._container[0])
     self.assertEqual(content.get('status'), 'success')
     self.assertEqual(model.model_feature_detail_set.all().count(), 2)
Пример #2
0
 def test_save_features(self):
     model = Model.objects.latest('created')
     self.assertEqual(model.model_feature_detail_set.all().count(), 1)
     url = reverse('panel_model_save_feature',  kwargs={'pk': model.id})
     data = {
         "feature_value": {
             "value_id": 138,
             "value_name": "Facebook"
         }
     }
     view = ModelFeatureCreateView.as_view()
     request = self.request_factory.post(
         url, data=dumps(data), content_type='application/json'
     )
     request.user = self.user
     response = view(request, pk=model.id)
     content = json.loads(response._container[0])
     self.assertEqual(content.get('status'), 'success')
     self.assertEqual(model.model_feature_detail_set.all().count(), 2)
Пример #3
0
    #Retry
    url(r'^model-control/list/$',
        ModelControlTemplateView.as_view(),
        name='panel_model_control_list'),
    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(),
Пример #4
0
        name='panel_model_control_list'),

    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>[^/]+)/$',