Example #1
0
    def test_save_model(self):
        self.assertEqual(Model.objects.all().count(), 4)
        data = {
            "name_complete": "jonathancarrasco garcia",
            "type_doc": {
                "id": 1,
                "name": "DNI"
            },
            "num_doc": "46223224",
            "address": "Jr catalino Miranda 356",
            "email": "*****@*****.**",
            "birth": "1978-08-12",
            "nationality": 1,
            "city": 66,
            "phone_fixed": "256-1212",
            "phone_mobil": "963726756",
            "gender": 1
        }

        view = ModelCreateView.as_view()
        request = self.request_factory.post(
            reverse('panel_model_save_profile'),
            data=dumps(data),
            content_type='application/json')
        request.user = self.user
        response = view(request)
        self.assertEqual(response.status_code, 200)
        content = json.loads(response._container[0])
        self.assertEqual(content.get('status'), "success")
        self.assertEqual(Model.objects.all().count(), 5)
Example #2
0
    def test_save_model(self):
        self.assertEqual(Model.objects.all().count(), 4)
        data = {
            "name_complete": "jonathancarrasco garcia",
            "type_doc": {"id": 1,"name": "DNI"},
            "num_doc": "46223224",
            "address": "Jr catalino Miranda 356",
            "email": "*****@*****.**",
            "birth": "1978-08-12",
            "nationality": 1,
            "city": 66,
            "phone_fixed": "256-1212",
            "phone_mobil": "963726756",
            "gender": 1
        }

        view = ModelCreateView.as_view()
        request = self.request_factory.post(
            reverse('panel_model_save_profile'), data=dumps(data), content_type='application/json'
        )
        request.user = self.user
        response = view(request)
        self.assertEqual(response.status_code, 200)
        content = json.loads(response._container[0])
        self.assertEqual(content.get('status'), "success")
        self.assertEqual(Model.objects.all().count(), 5)
Example #3
0
from apps.sp.views.panel.Model import ModelFeatureDeleteView
from apps.sp.views.panel.Model import ModelFeatureUpdateView
from apps.sp.views.panel.Model import ModelUpdateView
from apps.sp.views.panel.Model import ModelSimpleSearchView
from apps.sp.views.panel.Model import ModelControlTemplateView, \
    DeleteImageModelView, QuickModelUpdateView

urlpatterns = patterns(
    '',

    #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(),
Example #4
0
from apps.sp.views.panel.Model import ModelFeatureDeleteView
from apps.sp.views.panel.Model import ModelFeatureUpdateView
from apps.sp.views.panel.Model import ModelUpdateView
from apps.sp.views.panel.Model import ModelSimpleSearchView
from apps.sp.views.panel.Model import ModelControlTemplateView, \
    DeleteImageModelView, QuickModelUpdateView

urlpatterns = patterns('',

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