Commit 5cf2f2e7 authored by Kedar A.'s avatar Kedar A. 💻

Conflicts resolved with commit of snapshot

parents 4ddd67a4 3a8b6005
from gnowsys_ndf.ndf.models import *
from gnowsys_ndf.ndf.models import HistoryManager
import subprocess
import string
from django.core.management.base import BaseCommand, CommandError
history_manager = HistoryManager()
#AttributeType,RelationType
def get_last_published_version(node):
published_node_version = ""
rcs = RCS()
fp = history_manager.get_file_path(node)
cmd= 'rlog %s' % \
(fp)
rev_no =""
proc1=subprocess.Popen(cmd,shell=True,
stdout=subprocess.PIPE)
for line in iter(proc1.stdout.readline,b''):
if line.find('revision')!=-1 and line.find('selected') == -1:
rev_no=string.split(line,'revision')
rev_no=rev_no[1].strip( '\t\n\r')
rev_no=rev_no.strip(' ')
if line.find('PUBLISHED')!=-1:
published_node_version = rev_no
break;
return published_node_version
class Command(BaseCommand):
help = "Based on "
def handle(self, *args, **options):
# all_nodes = node_collection.find({ "_type":{"$nin":["ToReduceDocs","IndexedWordList","node_holder", "AttributeType", "RelationType", "MetaType", "ProcessType", "GSystemType", "Group", "Author"]},"snapshot":{"$exists":False}})
all_nodes = node_collection.find({ "_type":{"$in":["GSystem","File"]},"snapshot":{"$exists":False}})
nodes = node_collection.find({ "_type":{"$in":["GSystem","File"]},"snapshot":{}})
print "No.of Nodes not having Snapshot feilds: ", all_nodes.count()
for i in all_nodes:
node_collection.collection.update({'_id':ObjectId(i._id)}, {'$set':{'snapshot': {} }},upsert=False, multi=False)
print "No. of Nodes not having values in snapshot feild: ", nodes.count()
if nodes.count() > 0:
for i in nodes:
try:
print i.name
get_node = node_collection.find_one({"_id":ObjectId(i._id)})
if (not get_node['group_set']) == False :
print "providing resource version to resource name: ", i.name
for j in get_node['group_set']:
id_type = node_collection.find_one({"_id":ObjectId(j)})
if id_type and id_type._type == 'Group':
rcsno = get_last_published_version(i)
if not rcsno:
rcsno = history_manager.get_current_version(i)
node_collection.collection.update({"_id":ObjectId(i._id)},{'$set':{'snapshot'+"."+str(j):rcsno }},upsert=False,multi=False)
elif id_type and id_type._type == 'Author':
rcsno = history_manager.get_current_version(i)
node_collection.collection.update({"_id":ObjectId(i._id)},{'$set':{'snapshot'+"."+str(j):rcsno }},upsert=False,multi=False)
else:
pass
except:
print "Nodes getting Error"
print "==================="
print "Node name",i.name
print "==================="
pass
else:
print "No Node to update. !!"
......@@ -227,7 +227,7 @@ class Node(DjangoDocument):
'rating':[{'score':int,
'user_id':int,
'ip_address':basestring}],
'snapshot':dict
'snapshot':dict
}
required_fields = ['name', '_type'] # 'group_set' to be included
......@@ -379,7 +379,7 @@ class Node(DjangoDocument):
return self.__unicode__()
def save(self, *args, **kwargs):
if "is_changed" in kwargs:
if "is_changed" in kwargs:
if not kwargs["is_changed"]:
#print "\n ", self.name, "(", self._id, ") -- Nothing has changed !\n\n"
return
......@@ -508,7 +508,12 @@ class Node(DjangoDocument):
except Exception as err:
print "\n DocumentError: This document (", self._id, ":", self.name, ") can't be updated!!!\n"
raise RuntimeError(err)
#gets the last version no.
rcsno = history_manager.get_current_version(self)
#update the snapshot feild
if kwargs.get('groupid'):
node_collection.collection.update({'_id':self._id}, {'$set': {'snapshot'+"."+str(kwargs['groupid']):rcsno }}, upsert=False, multi=True)
# User-Defined Functions
def get_possible_attributes(self, gsystem_type_id_or_list):
"""Returns user-defined attribute(s) of given node which belongs to
......
......@@ -6,12 +6,10 @@
color:#0b8a91 !important;
}
.selFile {
border-radius: 1px;
box-shadow:3px 3px 3px 2px rgba(9,9,9,0.2);
border-radius: 3px;
box-shadow:1px 1px 1px 1px rgba(1,1,1,0.2);
}
.container-div:nth-child(odd) { background: #f7fcfb; }
.container-div:nth-child(even) { background: #e4f5f2; }
</style>
<div class="content" id="status" align="left">
......@@ -20,17 +18,18 @@
{% for i in activity_list %}
{% get_url i.pk as res_type %}
{% if res_type != "None" %}
<div class="container-div selFile">
<div id="top_list" class="row coloring" >
<div id="name-div" class="small-2 column text-center" style="word-wrap: break-word;">
<div class="container-div selFile" style="height:50px; background-color:#f7fcfb;">
<div id="top_list" style="position:relative; top:15px;" >
<div id="name-div" style=" position:absolute; word-wrap: break-word; float:left; ">
<a href="{% url 'dashboard' i.created_by %}"> {{i.user_details_dict.created_by}} </a>
</div>
<div id="action" class="small-2 column ">
<div id="action" style=" position:relative; left:6%; float:left;">
has {{i.activity}}
</div>
<div id="create_type" class="small-2 column" style="word-wrap: break-word; " >
<div id="create_type" style=" position:relative; left:6.5%; word-wrap: break-word; width:auto; float:left; " >
{% if res_type != "event_app_instance_detail" %}
<a href="{% url res_type groupid i.pk %}"> {{i.name}} </a>
......@@ -40,10 +39,10 @@
<a href="{% url res_type groupid app_set_id i.pk %}">{{i.name}} </a>
{% endif %}
</div>
<div id="performed on" class="small-2 column" style="word-wrap: break-word;" >
<div id="performed on" class="small-2 column" style=" position:relative; word-wrap: float:left; break-word; width:auto; left:6%;" >
{{i.created_at|timesince}} ago
</div>
<div class="small-2 small-pull-2 column" align="center" >
<div align="right" style="position:relative; right:4%; top:-15px;" >
{% if 'image' in i.mime_type %}
<a href="{% url res_type groupid i.pk %}"> <div> <img src="{% url 'getFileThumbnail' group_id i.pk %}" style="height:50px; width:50px;"> </div>
</a>
......@@ -71,7 +70,10 @@
<i class="fi-page largesize" ></i>
{% endif %}
</div>
</div>
......@@ -79,6 +81,8 @@
</div>
{% endif %}
<div style="height:10px;">
</div>
{% endfor %}
</div>
</div>
......
......@@ -143,7 +143,7 @@ def adminDashboardEdit(request):
node['relation_type_set'] = typelist
node.save()
node.save(groupid=group_id)
return StreamingHttpResponse(node.name+" edited successfully")
except Exception as e:
return StreamingHttpResponse(e)
......
......@@ -265,13 +265,13 @@ def shelf(request, group_id):
shelf_gs.name = unicode(shelf)
shelf_gs.created_by = int(request.user.id)
shelf_gs.member_of.append(shelf_gst._id)
shelf_gs.save()
shelf_gs.save(groupid=group_id)
shelf_R = triple_collection.collection.GRelation()
shelf_R.subject = ObjectId(auth._id)
shelf_R.relation_type = has_shelf_RT
shelf_R.right_subject = ObjectId(shelf_gs._id)
shelf_R.save()
shelf_R.save(groupid=group_id)
else:
if shelf_add:
shelf_item = ObjectId(shelf_add)
......@@ -846,7 +846,7 @@ def add_sub_themes(request, group_id):
node = node_collection.collection.GSystem()
# get_node_common_fields(request, node, group_id, theme_GST)
node.save(is_changed=get_node_common_fields(request, node, group_id, theme_item_GST))
node.save(is_changed=get_node_common_fields(request, node, group_id, theme_item_GST),groupid=group_id)
node.reload()
# Add this sub-theme into context nodes collection_set
node_collection.collection.update({'_id': context_node._id}, {'$push': {'collection_set': ObjectId(node._id) }}, upsert=False, multi=False)
......@@ -877,7 +877,7 @@ def add_theme_item(request, group_id):
theme_item_node = node_collection.collection.GSystem()
theme_item_node.save(is_changed=get_node_common_fields(request, theme_item_node, group_id, theme_item_GST))
theme_item_node.save(is_changed=get_node_common_fields(request, theme_item_node, group_id, theme_item_GST),groupid=group_id)
theme_item_node.reload()
# Add this theme item into context theme's collection_set
......@@ -906,7 +906,7 @@ def add_topics(request, group_id):
node = node_collection.collection.GSystem()
# get_node_common_fields(request, node, group_id, topic_GST)
node.save(is_changed=get_node_common_fields(request, node, group_id, topic_GST))
node.save(is_changed=get_node_common_fields(request, node, group_id, topic_GST),groupid=group_id)
node.reload()
# Add this topic into context nodes collection_set
node_collection.collection.update({'_id': context_node._id}, {'$push': {'collection_set': ObjectId(node._id) }}, upsert=False, multi=False)
......@@ -940,11 +940,13 @@ def add_page(request, group_id):
if name not in collection_list:
page_node = node_collection.collection.GSystem()
page_node.save(is_changed=get_node_common_fields(request, page_node, group_id, gst_page))
page_node.save(is_changed=get_node_common_fields(request, page_node, group_id, gst_page),groupid=group_id)
page_node.status = u"PUBLISHED"
page_node.save()
context_node.collection_set.append(page_node._id)
context_node.save()
context_node.save(groupid=group_id)
response_dict["success"] = True
return HttpResponse(json.dumps(response_dict))
......@@ -999,8 +1001,8 @@ def add_file(request, group_id):
context_node.collection_set.append(old_file_node._id)
old_file_node.status = u"PUBLISHED"
old_file_node.prior_node.append(context_node._id)
old_file_node.save()
context_node.save()
old_file_node.save(groupid=group_id)
context_node.save(groupid=group_id)
else:
# If availbale ,then return to the topic page
return HttpResponseRedirect(url_name)
......@@ -1014,10 +1016,10 @@ def add_file(request, group_id):
file_obj = node_collection.find_one({'_id': ObjectId(str(cur_oid["docid"]))})
file_obj.prior_node.append(context_node._id)
file_obj.status = u"PUBLISHED"
file_obj.save()
file_obj.save(groupid=group_id)
context_node.collection_set.append(file_obj._id)
file_obj.save()
context_node.save()
file_obj.save(groupid=group_id)
context_node.save(groupid=group_id)
return HttpResponseRedirect(url_name)
......@@ -1186,7 +1188,7 @@ def change_group_settings(request,group_id):
group_node.disclosure_policy = disclosure_policy
group_node.encryption_policy = encryption_policy
group_node.modified_by = int(request.user.id)
group_node.save()
group_node.save(groupid=group_id)
return HttpResponse("changed successfully")
except:
return HttpResponse("failed")
......@@ -1255,7 +1257,7 @@ def make_module_set(request, group_id):
if(check == 'True'):
return HttpResponse("This module already Exists")
else:
gsystem_obj.save()
gsystem_obj.save(groupid=group_id)
create_relation_of_module(node._id, gsystem_obj._id)
create_version_of_module(gsystem_obj._id,node._id)
check1 = sotore_md5_module_set(gsystem_obj._id, module_set_md5)
......@@ -2164,7 +2166,7 @@ def remove_user_from_author_set(request, group_id):
if node.created_by == request.user.id:
node.author_set.remove(user_id)
can_remove = True
node.save()
node.save(groupid=group_id)
if node.author_set:
for each in node.author_set:
......@@ -2282,7 +2284,7 @@ def annotationlibInSelText(request, group_id):
}
sg_obj.annotations.append(ann)
sg_obj.save()
sg_obj.save(groupid=group_id)
return HttpResponse(json.dumps(sg_obj.annotations))
......@@ -4698,7 +4700,7 @@ def edit_task_title(request, group_id):
title = request.POST.get('title',"")
task = node_collection.find_one({'_id':ObjectId(taskid)})
task.name = title
task.save()
task.save(groupid=group_id)
return HttpResponse(task.name)
else:
raise Http404
......@@ -4718,7 +4720,7 @@ def edit_task_content(request, group_id):
usrname = request.user.username
filename = slugify(task.name) + "-" + usrname + "-"
task.content = org2html(content_org, file_prefix=filename)
task.save()
task.save(groupid=group_id)
return HttpResponse(task.content)
else:
raise Http404
......@@ -4788,7 +4790,7 @@ def save_time(request, group_id, node):
name_arr = name.split("--")
new_name = unicode(str(name_arr[0]) + "--" + str(name_arr[1]) + "--" + str(start_time))
event_node.name = new_name
event_node.save()
event_node.save(groupid=group_id)
return HttpResponse("Session rescheduled")
@get_execution_time
......
......@@ -196,7 +196,7 @@ def save_batch(request, group_id):
b_node.contributors.append(int(request.user.id))
b_node.modified_by = int(request.user.id)
b_node.save()
b_node.save(groupid=group_id)
all_batches_in_grp.append(b_node._id)
rt_group_has_batch = node_collection.one({'_type': 'RelationType', 'name': 'group_has_batch'})
......@@ -276,7 +276,7 @@ def remove_stud_from_batch(request, group_id):
)
grelation_node.status = u"DELETED"
grelation_node.save()
grelation_node.save(groupid=group_id)
status = "success"
return HttpResponse(json.dumps(status, cls=NodeJSONEncoder))
......
......@@ -145,7 +145,7 @@ def create_edit(request, group_id, node_id=None):
if request.method == "POST":
# get_node_common_fields(request, course_node, group_id, GST_COURSE)
course_node.save(is_changed=get_node_common_fields(request, course_node, group_id, GST_COURSE))
course_node.save(is_changed=get_node_common_fields(request, course_node, group_id, GST_COURSE),groupid=group_id)
create_gattribute(course_node._id, at_course_type, u"General")
return HttpResponseRedirect(reverse('course', kwargs={'group_id': group_id}))
......@@ -486,7 +486,7 @@ def course_create_edit(request, group_id, app_id, app_set_id=None, app_set_insta
course_gs.content_org = cnode_for_content.content_org
course_gs.content = cnode_for_content.html_content
course_gs.save(is_changed=is_changed)
course_gs.save(is_changed=is_changed,groupid=group_id)
# [B] Store AT and/or RT field(s) of given course-node
for tab_details in property_order_list:
......@@ -574,7 +574,7 @@ def course_create_edit(request, group_id, app_id, app_set_id=None, app_set_insta
# Remove this when publish button is setup on interface
course_gs.status = u"PUBLISHED"
course_gs.save(is_changed=is_changed)
course_gs.save(is_changed=is_changed,groupid=group_id)
# [B] Store AT and/or RT field(s) of given course-node
for tab_details in property_order_list:
......@@ -1116,7 +1116,7 @@ def save_course_section(request, group_id):
cs_new.contributors.append(int(request.user.id))
course_node = node_collection.one({"_id": ObjectId(course_node_id)})
cs_new.prior_node.append(ObjectId(course_node._id))
cs_new.save()
cs_new.save(groupid=group_id)
node_collection.collection.update({'_id': course_node._id}, {'$push': {'collection_set': cs_new._id }}, upsert=False, multi=False)
response_dict["success"] = True
response_dict["cs_new_id"] = str(cs_new._id)
......@@ -1167,7 +1167,7 @@ def save_course_sub_section(request, group_id):
cs_node = node_collection.one({"_id": ObjectId(cs_node_id)})
css_new.prior_node.append(cs_node._id)
css_new.save()
css_new.save(groupid=group_id)
node_collection.collection.update({'_id': cs_node._id}, {'$push': {'collection_set': css_new._id }}, upsert=False, multi=False)
response_dict["success"] = True
response_dict["css_new_id"] = str(css_new._id)
......@@ -1191,7 +1191,7 @@ def change_node_name(request, group_id):
new_name = request.POST.get("new_name", '')
node = node_collection.one({"_id": ObjectId(node_id)})
node.name = new_name.strip()
node.save()
node.save(groupid=group_id)
response_dict["success"] = True
return HttpResponse(json.dumps(response_dict))
......@@ -1432,7 +1432,7 @@ def save_resources(request, group_id):
cu_new.contributors.append(int(request.user.id))
cu_new.prior_node.append(css_node._id)
cu_new.save()
cu_new.save(groupid=group_id)
response_dict["create_new_unit"] = True
node_collection.collection.update({'_id': cu_new._id}, {'$set': {'name': unit_name }}, upsert=False, multi=False)
......@@ -1491,7 +1491,7 @@ def create_edit_unit(request, group_id):
cu_node.status = u"PUBLISHED"
cu_node.contributors.append(int(request.user.id))
cu_node.prior_node.append(css_node._id)
cu_node.save()
cu_node.save(groupid=group_id)
response_dict["unit_node_id"] = str(cu_node._id)
node_collection.collection.update({'_id': cu_node._id}, {'$set': {'name': unit_name}}, upsert=False, multi=False)
......
......@@ -348,9 +348,9 @@ def custom_app_new_view(request, group_id, app_name, app_id, app_set_id=None, ap
if user_group_location:
user_group_location['visited_location'] = user_last_visited_location
user_group_location.save()
user_group_location.save(groupid=group_id)
newgsystem.save()
newgsystem.save(groupid=group_id)
if not app_set_instance_id :
for key,value in request_at_dict.items():
......@@ -359,7 +359,7 @@ def custom_app_new_view(request, group_id, app_name, app_id, app_set_id=None, ap
newattribute.subject = newgsystem._id
newattribute.attribute_type = attributetype_key
newattribute.object_value = value
newattribute.save()
newattribute.save(groupid=group_id)
for key,value in request_rt_dict.items():
if key:
relationtype_key = node_collection.find_one({"_id":ObjectId(key)})
......@@ -369,14 +369,14 @@ def custom_app_new_view(request, group_id, app_name, app_id, app_set_id=None, ap
newrelation.subject = newgsystem._id
newrelation.relation_type = relationtype_key
newrelation.right_subject = right_subject._id
newrelation.save()
newrelation.save(groupid=group_id)
if app_set_instance_id : # editing instance
for each in systemtype_attributetype_set:
if each["database_id"]:
attribute_instance = node_collection.find_one({"_id":ObjectId(each['database_id'])})
attribute_instance.object_value = request.POST.get(each["database_id"],"")
attribute_instance.save()
attribute_instance.save(groupid=group_id)
else :
if request.POST.get(each["type_id"],""):
attributetype_key = node_collection.find_one({"_id":ObjectId(each["type_id"])})
......@@ -384,13 +384,13 @@ def custom_app_new_view(request, group_id, app_name, app_id, app_set_id=None, ap
newattribute.subject = newgsystem._id
newattribute.attribute_type = attributetype_key
newattribute.object_value = request.POST.get(each["type_id"],"")
newattribute.save()
newattribute.save(groupid=group_id)
for eachrt in systemtype_relationtype_set:
if eachrt["database_id"]:
relation_instance = node_collection.find_one({"_id":ObjectId(eachrt['database_id'])})
relation_instance.right_subject = ObjectId(request.POST.get(eachrt["database_id"],""))
relation_instance.save()
relation_instance.save(groupid=group_id)
else :
if request.POST.get(eachrt["type_id"],""):
relationtype_key = node_collection.find_one({"_id":ObjectId(eachrt["type_id"])})
......@@ -399,7 +399,7 @@ def custom_app_new_view(request, group_id, app_name, app_id, app_set_id=None, ap
newrelation.subject = newgsystem._id
newrelation.relation_type = relationtype_key
newrelation.right_subject = right_subject._id
newrelation.save()
newrelation.save(groupid=group_id)
return HttpResponseRedirect(reverse('GAPPS_set', kwargs={'group_id': group_id, 'app_name': app_name, "app_id":app_id, "app_set_id":app_set_id}))
......
......@@ -343,7 +343,7 @@ def data_review_save(request, group_id):
is_changed = True
if is_changed:
file_node.save()
file_node.save(groupid=group_id)
# print edit_summary
......
......@@ -355,7 +355,7 @@ def enrollment_create_edit(request, group_id, app_id, app_set_id=None, app_set_i
enrollment_gs.last_update = datetime.datetime.today()
enrollment_gs.status = u"PUBLISHED"
enrollment_gs.save()
enrollment_gs.save(groupid=group_id)
enrollment_task_ids = None
each_enrollment_task_node = None
......@@ -591,7 +591,7 @@ def enrollment_create_edit(request, group_id, app_id, app_set_id=None, app_set_i
enrollment_gs.last_update = datetime.datetime.today()
enrollment_gs.status = u"PUBLISHED"
enrollment_gs.save()
enrollment_gs.save(groupid=group_id)
enrollment_task_ids = None
each_enrollment_task_node = None
......
......@@ -414,7 +414,7 @@ def event_create_edit(request, group_id, app_set_id=None, app_set_instance_id=No
name= "Class" + "--"+ slugify(request.POST.get("course_name","")) + "--" + field_value
event_gs.name=name
event_gs.save(is_changed=is_changed)
event_gs.save(is_changed=is_changed,groupid=group_id)
# print "\n Event: ", event_gs._id, " -- ", event_gs.name, "\n"
# [B] Store AT and/or RT field(s) of given event-node (i.e., event_gs)
......
......@@ -950,7 +950,7 @@ def save_file(files,title, userid, group_id, content_org, tags, img_type = None,
fileobj.location = map_geojson_data
fileobj.save()
fileobj.save(groupid=group_id)
if source:
# create gattribute for file with source value
......@@ -1473,7 +1473,7 @@ def file_edit(request,group_id,_id):
if request.method == "POST":
# get_node_common_fields(request, file_node, group_id, GST_FILE)
file_node.save(is_changed=get_node_common_fields(request, file_node, group_id, GST_FILE))
file_node.save(is_changed=get_node_common_fields(request, file_node, group_id, GST_FILE),groupid=group_id)
if "CourseEventGroup" not in group_obj.member_of_names_list:
# To fill the metadata info while creating and editing file node
metadata = request.POST.get("metadata_info", '')
......
......@@ -196,7 +196,7 @@ def create_forum(request, group_id):
# end_dt[end_time.name]=en_date
# colf.attribute_set.append(start_dt)
# colf.attribute_set.append(end_dt)
colf.save()
colf.save(groupid=group_id)
'''Code to send notification to all members of the group except those whose notification preference is turned OFF'''
link="http://"+sitename+"/"+str(colg._id)+"/forum/"+str(colf._id)
......@@ -318,7 +318,7 @@ def edit_forum(request,group_id,forum_id):
# end_dt[end_time.name]=en_date
# colf.attribute_set.append(start_dt)
# colf.attribute_set.append(end_dt)
colf.save()
colf.save(groupid=group_id)
'''Code to send notification to all members of the group except those whose notification preference is turned OFF'''
link="http://"+sitename+"/"+str(colg._id)+"/forum/"+str(colf._id)
......@@ -526,7 +526,7 @@ def create_thread(request, group_id, forum_id):
colrep.contributors.append(usrid)
colrep.group_set.append(colg._id)
colrep.save()
colrep.save(groupid=group_id)
'''Code to send notification to all members of the group except those whose notification preference is turned OFF'''
link="http://"+sitename+"/"+str(colg._id)+"/forum/thread/"+str(colrep._id)
......@@ -682,7 +682,7 @@ def add_node(request, group_id):
colrep.contributors.append(usrid)
colrep.group_set.append(colg._id)
colrep.save()
colrep.save(groupid=group_id)
# print "----------", colrep._id
groupname = colg.name
......@@ -892,7 +892,7 @@ def edit_thread(request,group_id,forum_id,thread_id):
usrname = request.user.username
filename = slugify(name) + "-" + usrname + "-"
thread.content = org2html(content_org, file_prefix=filename)
thread.save()
thread.save(groupid=group_id)
link="http://"+sitename+"/"+str(colg._id)+"/forum/thread/"+str(thread._id)
for each in colg.author_set:
if each != colg.created_by:
......
......@@ -2074,7 +2074,7 @@ def publish_group(request,group_id,node):
node.content_org=page_node.content_org
node.status=unicode("PUBLISHED")
node.modified_by = int(request.user.id)
node.save()
node.save(groupid=group_id)
return render_to_response("ndf/groupdashboard.html",
{ 'group_id':group_id, 'groupid':group_id,
......@@ -2136,11 +2136,11 @@ def create_sub_group(request,group_id):
colg.agency_type=request.POST.get('agency_type',"")
if group_id:
colg.prior_node.append(group_ins._id)
colg.save()
colg.save(groupid=group_id)
#save subgroup_id in the collection_set of parent group
group_ins.collection_set.append(colg._id)
#group_ins.post_node.append(colg._id)
group_ins.save()
group_ins.save(groupid=group_id)
if colg.edit_policy == "EDITABLE_MODERATED":
Mod_colg.altnames = cname + "Mod"
......@@ -2153,10 +2153,10 @@ def create_sub_group(request,group_id):
if usrid not in Mod_colg.contributors:
Mod_colg.contributors.append(usrid)
Mod_colg.prior_node.append(colg._id)
Mod_colg.save()
Mod_colg.save(groupid=group_id)
colg.post_node.append(Mod_colg._id)
colg.save()
colg.save(groupid=group_id)
auth = node_collection.one({'_type': 'Author', 'name': unicode(request.user.username) })
has_shelf_RT = node_collection.one({'_type': 'RelationType', 'name': u'has_shelf' })
shelves = []
......
......@@ -58,7 +58,7 @@ def homepage(request, group_id):
auth.group_affiliation = temp_details.details_to_hold['group_affiliation']
except e as Exception:
print "error in getting node_holder details for an author"+str(e)
auth.save()
auth.save(groupid=group_id)
# as on when user gets register on platform make user member of two groups:
# 1: his/her own username group. 2: "home" group
......@@ -67,7 +67,7 @@ def homepage(request, group_id):
# being user is log-in for first time on site after registration,
# directly add user's id into author_set of home group without anymore checking overhead.
home_group_obj.author_set.append(request.user.id)
home_group_obj.save()
home_group_obj.save(groupid=group_id)
if GSTUDIO_SITE_LANDING_PAGE == "home":
......
......@@ -216,7 +216,8 @@ def image_edit(request,group_id,_id):
title = GST_IMAGE.name
if request.method == "POST":
# get_node_common_fields(request, img_node, group_id, GST_IMAGE)
img_node.save(is_changed=get_node_common_fields(request, img_node, group_id, GST_IMAGE))
img_node.save(is_changed=get_node_common_fields(request, img_node, group_id, GST_IMAGE),groupid=group_id)
if "CourseEventGroup" not in group_obj.member_of_names_list:
get_node_metadata(request,img_node)
teaches_list = request.POST.get('teaches_list','') # get the teaches list
......
......@@ -31,7 +31,7 @@ def lang_pref(request):
if not auth.agency_type:
auth.agency_type = "Other" # Sets default value for agency_type as "Other"
auth.modified_by=request.user.id
auth.save()
auth.save(groupid=group_id)
if appid:
appname = node_collection.one({'_id': ObjectId(str(appid))})
return HttpResponseRedirect("/home/"+appname.name.lower())
......
......@@ -128,7 +128,7 @@ def invite_meeting(request, group_id, meetingid):
ret = set_notif_val(request,group_id,msg,activ,bx)
if bx.id not in colg.author_set:
colg.author_set.append(bx.id)
colg.save()
colg.save(groupid=group_id)
if ret :
return HttpResponse("success")
......
......@@ -1020,7 +1020,7 @@ def get_node_common_fields(request, node, group_id, node_type, coll_set=None):
else:
user_group_location['visited_location'] = user_last_visited_location
user_group_location.save()
user_group_location.save(groupid=group_id)
if is_changed:
node.status = unicode("DRAFT")
......@@ -2563,7 +2563,6 @@ def set_all_urls(member_of):