コード例 #1
0
    def test_update_features(self):
        model = Model.objects.latest('created')
        self.assertEqual(model.model_feature_detail_set.all().count(), 1)
        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()

        url = reverse('panel_model_update_feature', kwargs={'pk': model.id})
        data = {
            "feature": {
                "value_id": 139,
                "value_name": "Twitter"
            },
            "description": "olalal",
            "model_feature_id": model_feature_detail.id
        }
        view = ModelFeatureUpdateView.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_update_features(self):
        model = Model.objects.latest('created')
        self.assertEqual(model.model_feature_detail_set.all().count(), 1)
        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()

        url = reverse('panel_model_update_feature',  kwargs={'pk': model.id})
        data = {
                "feature": {
                    "value_id": 139,
                    "value_name": "Twitter"
                },
            "description": "olalal",
            "model_feature_id": model_feature_detail.id
        }
        view = ModelFeatureUpdateView.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
ファイル: model.py プロジェクト: jonathancg90/appSpiral
     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(),
     name='panel_model_save_picture'),
 url(r'^model-control/simple-search/$',
     ModelSimpleSearchView.as_view(),
コード例 #4
0
ファイル: model.py プロジェクト: jonathancg90/appSpiral
        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/$',