def updateHub(request,data_type,data_value): hub_id = data_value authed, user = ttagServiceAuth(request) if authed: access_token = request.COOKIES['access_token'] user_id = user["_id"] if 'hub_name' in request.POST and 'hub_desc' in request.POST: hub_name = request.POST["hub_name"] hub_desc = request.POST["hub_desc"] response = ttagUpdateHub(user_id, access_token, hub_id,hub_name, hub_desc,"true", "0") if response["result"] == "OK": hub = response["data"]["hub"] return render_to_response('hub/hub_update.html', locals(), context_instance=RequestContext(request)) else: hub = response["data"]["hub"] return render_to_response('hub/hub_update.html', locals(), context_instance=RequestContext(request)) else: response = ttagGetHubByHubId(hub_id) if response["result"] == "OK": hub = response["data"]["hub"] return render_to_response('hub/hub_update.html', locals(), context_instance=RequestContext(request)) else: return HttpResponse(response["msg"]) else: return HttpResponse("Invalid request")
def save(self, user, request): aToken = request.COOKIES.get('access_token','') if self.creater_id != user.user_id or len(aToken) == 0 : return False else : response = ttagUpdateHub(user._id,request.COOKIES['access_token'],self.hub_id,self.hub_name,self.hub_desc,self.hub_icon,self.hub_image,self.is_private,self.hub_state,self.site_link) if response['result'] == 'OK' : return True else : return response['msg']
def updateHub(request, data_type, data_value): hub_id = data_value authed, user = ttagServiceAuth(request) if authed: access_token = request.COOKIES['access_token'] user_id = user["_id"] if 'hub_name' in request.POST and 'hub_desc' in request.POST: hub_name = request.POST["hub_name"] hub_desc = request.POST["hub_desc"] response = ttagUpdateHub(user_id, access_token, hub_id, hub_name, hub_desc, "true", "0") if response["result"] == "OK": hub = response["data"]["hub"] return render_to_response( 'hub/hub_update.html', locals(), context_instance=RequestContext(request)) else: hub = response["data"]["hub"] return render_to_response( 'hub/hub_update.html', locals(), context_instance=RequestContext(request)) else: response = ttagGetHubByHubId(hub_id) if response["result"] == "OK": hub = response["data"]["hub"] return render_to_response( 'hub/hub_update.html', locals(), context_instance=RequestContext(request)) else: return HttpResponse(response["msg"]) else: return HttpResponse("Invalid request")