diff options
author | Kedar Aitawdekar <kedar2a@gmail.com> | 2015-07-07 11:42:27 +0530 |
---|---|---|
committer | Kedar Aitawdekar <kedar2a@gmail.com> | 2015-07-07 11:42:27 +0530 |
commit | 260dfe404b642a2f9b0b0e9568b04a047a83219b (patch) | |
tree | 7763dda4e9c7301b875e7f985f3897b55050bdb8 /gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py | |
parent | 2b0b9640310477dadbc5e420b3238a3c968fa030 (diff) | |
parent | ebd6ef6ff10522b487b53424527b1637ec16bcee (diff) | |
download | gnowsys-260dfe404b642a2f9b0b0e9568b04a047a83219b.tar.gz |
Merge branch 'mongokit-graph' into mongokit-dev
Diffstat (limited to 'gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py')
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py b/gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py index 64a26b32..7143e78e 100644 --- a/gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py +++ b/gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py @@ -487,7 +487,7 @@ def get_drawers(group_id, nid=None, nlist=[], page_no=1, checked=None, **kwargs) for each in drawer: if each._id not in nlist: dict1[each._id] = each - + for oid in nlist: obj = node_collection.one({'_id': oid}) dict2.append(obj) @@ -502,9 +502,12 @@ def get_drawers(group_id, nid=None, nlist=[], page_no=1, checked=None, **kwargs) if each._id not in nlist: dict1[each._id] = each - for oid in nlist: + + for oid in nlist: obj = node_collection.one({'_id': oid}) dict2.append(obj) + + dict_drawer['1'] = dict1 dict_drawer['2'] = dict2 @@ -813,11 +816,12 @@ def build_collection(node, check_collection, right_drawer_list, checked): if node.prior_node != right_drawer_list: i = 0 node.prior_node=[] + node_prior_node_append_temp=node.prior_node.append #a temp. variable which stores the lookup for append method while (i < len(right_drawer_list)): node_id = ObjectId(right_drawer_list[i]) node_obj = node_collection.one({"_id": node_id}) if node_obj: - node.prior_node.append(node_id) + node_prior_node_append_temp(node_id) i = i+1 # print "\n Changed: prior_node" @@ -838,14 +842,16 @@ def build_collection(node, check_collection, right_drawer_list, checked): i = 0 node.collection_set = [] # checking if each _id in collection_list is valid or not + nlist_append_temp=nlist.append #a temp. variable which stores the lookup for append method + node_collection_set_append_temp=node.collection_set.append #a temp. variable which stores the lookup for append method while (i < len(right_drawer_list)): node_id = ObjectId(right_drawer_list[i]) node_obj = node_collection.one({"_id": node_id}) if node_obj: if node_id not in nlist: - nlist.append(node_id) + nlist_append_temp(node_id) else: - node.collection_set.append(node_id) + node_collection_set_append_temp(node_id) # After adding it to collection_set also make the 'node' as prior node for added collection element node_collection.collection.update({'_id': ObjectId(node_id), 'prior_node': {'$nin':[node._id]} },{'$push': {'prior_node': ObjectId(node._id)}}) @@ -853,7 +859,7 @@ def build_collection(node, check_collection, right_drawer_list, checked): for each in nlist: if each not in node.collection_set: - node.collection_set.append(each) + node_collection_set_append_temp(each) node.status = u"PUBLISHED" node.save() # After adding it to collection_set also make the 'node' as prior node for added collection element @@ -4003,3 +4009,5 @@ def repository(request, group_id): }, context_instance=RequestContext(request) ) + + |