Beispiel #1
0
    def conn_search_del(self, request):
        """ Search and delete connections """
        conn = ConnectionAPI()
        conn_list = []
        if request.GET and not request.POST:
            conn_list = conn.search(request.GET)
        elif request.POST:
            conn_list = conn.delete(request.POST.get('del_id', None), request.GET)

        #spec = self._search_spec('connection', spec_name=request.GET['specification_name'])
        return render_to_response('connection_search.html',
                                  {'res_list': conn_list, 'elem_type': ELEM_TYPES['IS_CONN']},
                                  context_instance=RequestContext(request))
Beispiel #2
0
    def resource(self,request):
        """ Render resource page for creating and modifying """
        # render UPDATE page for resource
        if request.GET.get('elem_id', None):
            # get connections list
            connection = ConnectionAPI()
            conn_list_raw = connection.search()
            conn_list = []
            if conn_list_raw:
                for conn in conn_list_raw:
                    conn_list.append(conn['specification_name'])

            return render_to_response('resource.html',
                                      {'res_id': request.GET['elem_id'], 'conn_list': list(set(conn_list))},
                                      context_instance=RequestContext(request))
        # render CREATE page resource
        # get specs for creating resource
        res_spec_list = self._search_spec(ELEM_TYPES['IS_RES'])
        return render_to_response('resource_create.html',
                                  {'items_list': res_spec_list},
                                  context_instance=RequestContext(request))