Esempio n. 1
0
    def read(self, request, workspace_id):
        user = get_user_authentication(request)
        wiring = {}

        try:
            igadgets = IGadget.objects.filter(tab__workspace__pk=workspace_id)
            igadget_data_list = get_wiring_data(igadgets)
            wiring['iGadgetList'] = igadget_data_list

            tabs = Tab.objects.filter(workspace__pk=workspace_id)
            tab_data = serializers.serialize('python', tabs, ensure_ascii=False)
            wiring['tabList'] = [get_tab_data(d) for d in tab_data]

        except WorkSpace.DoesNotExist:
            wiring['iGadgetList'] = []
            wiring['tabList'] = []

        # InOut list
        inouts = InOut.objects.filter(workspace__pk=workspace_id)
        inout_data = serializers.serialize('python', inouts, ensure_ascii=False)
        wiring['inOutList'] = [get_inout_data(d) for d in inout_data]

        # Filter list
        filters = Filter.objects.all()
        filter_data = serializers.serialize('python', filters, ensure_ascii=False)
        wiring['filterList'] = [get_filter_data(d) for d in filter_data]

        return HttpResponse(json_encode(wiring), mimetype='application/json; charset=UTF-8')
Esempio n. 2
0
    def read(self, request, workspace_id):
        get_user_authentication(request)
        wiring = {}

        try:
            igadgets = IGadget.objects.filter(tab__workspace__pk=workspace_id)
            igadget_data_list = get_wiring_data(igadgets)
            wiring['iGadgetList'] = igadget_data_list

            tabs = Tab.objects.filter(workspace__pk=workspace_id)
            wiring['tabList'] = [get_tab_data(tab) for tab in tabs]

        except WorkSpace.DoesNotExist:
            wiring['iGadgetList'] = []
            wiring['tabList'] = []

        # InOut list
        inouts = InOut.objects.filter(workspace__pk=workspace_id)
        wiring['inOutList'] = [get_inout_data(inout) for inout in inouts]

        # Filter list
        filters = Filter.objects.all()
        wiring['filterList'] = [get_filter_data(f) for f in filters]

        return HttpResponse(json_encode(wiring), mimetype='application/json; charset=UTF-8')
Esempio n. 3
0
    def read(self, request, workspace_id):
        user = get_user_authentication(request)
        wiring = {}

        try:
            igadgets = IGadget.objects.filter(tab__workspace__pk=workspace_id)
            igadget_data_list = get_wiring_data(igadgets)
            wiring['iGadgetList'] = igadget_data_list

            tabs = Tab.objects.filter(workspace__pk=workspace_id)
            tab_data = serializers.serialize('python',
                                             tabs,
                                             ensure_ascii=False)
            wiring['tabList'] = [get_tab_data(d) for d in tab_data]

        except WorkSpace.DoesNotExist:
            wiring['iGadgetList'] = []
            wiring['tabList'] = []

        # InOut list
        inouts = InOut.objects.filter(workspace__pk=workspace_id)
        inout_data = serializers.serialize('python',
                                           inouts,
                                           ensure_ascii=False)
        wiring['inOutList'] = [get_inout_data(d) for d in inout_data]

        return HttpResponse(json_encode(wiring),
                            mimetype='application/json; charset=UTF-8')
Esempio n. 4
0
    def read(self, request, workspace_id, tab_id):
        user = get_user_authentication(request)

        tab = get_object_or_404(Tab, workspace__users__id=user.id, workspace__pk=workspace_id, pk=tab_id)
        tab_data = get_tab_data(tab)

        return HttpResponse(json_encode(tab_data), mimetype='application/json; charset=UTF-8')
Esempio n. 5
0
 def read(self, request, workspace_id, tab_id):
     user = get_user_authentication(request)
     
     tab = get_list_or_404(Tab, workspace__users__id=user.id, workspace__pk=workspace_id, pk=tab_id)
     data = serializers.serialize('python', tab, ensure_ascii=False)
     tab_data = get_tab_data(data[0])
     
     return HttpResponse(json_encode(tab_data), mimetype='application/json; charset=UTF-8')
Esempio n. 6
0
 def read(self, request, workspace_id, tab_id):
     user = get_user_authentication(request)
     
     tab = get_list_or_404(Tab, workspace__users__id=user.id, workspace__pk=workspace_id, pk=tab_id)
     data = serializers.serialize('python', tab, ensure_ascii=False)
     tab_data = get_tab_data(data[0])
     
     return HttpResponse(json_encode(tab_data), mimetype='application/json; charset=UTF-8')
Esempio n. 7
0
    def read(self, request, workspace_id, tab_id):
        user = get_user_authentication(request)

        tab = get_object_or_404(Tab,
                                workspace__users__id=user.id,
                                workspace__pk=workspace_id,
                                pk=tab_id)
        tab_data = get_tab_data(tab)

        return HttpResponse(json_encode(tab_data),
                            mimetype='application/json; charset=UTF-8')