Ejemplo n.º 1
0
def getHubMembers(request,data_type,data_value):
    loggedin, data = ttagServiceAuth(request)
    #"owner_id":"5064dd00559ae9da2b9e38b8","location_type":"HUB","user_id":"5064dd00559ae9da2b9e38b8","access_token":"ff891baeb4106593b40a5b9110c90f44"
    if loggedin:
        user_id = data["_id"]
        user_name = data["user_name"]
        response_hubs = ttagGetHubsByOwnerId(data['_id'], request.COOKIES['access_token'])
        response_count = ttagRequestCount(data['_id'])
        counts = response_count['counts']
        
        key_name = "hub_id"
        if data_type == "id":
            from_time = 0 if 'from_time' not in request.POST else request.POST['from_time']
            to_time = 4116171410000 if 'to_time' not in request.POST else request.POST['to_time']
            items_per_page = 10000 if 'items_per_page' not in request.POST else request.POST['items_per_page']
            page_number = 0 if 'page_number' not in request.POST else request.POST['page_number']
            response = ttagGetHubUsers(data_value, from_time, to_time, items_per_page, page_number)
        
        if response["result"] == "OK":
            hub_users= response["data"]["hub_users"]
            #context = {'hub_users': response["data"]["hub_users"],key_name:data_value}
            thereturn = render_to_response('hub/hub_members.html', locals(), context_instance=RequestContext(request))
            return thereturn
        else:
            return HttpResponse(response["msg"])
    else:
        return HttpResponseRedirect('/')
Ejemplo n.º 2
0
def getHubMembers(request, data_type, data_value):
    loggedin, data = ttagServiceAuth(request)
    #"owner_id":"5064dd00559ae9da2b9e38b8","location_type":"HUB","user_id":"5064dd00559ae9da2b9e38b8","access_token":"ff891baeb4106593b40a5b9110c90f44"
    if loggedin:
        user_id = data["_id"]
        user_name = data["user_name"]
        response_hubs = ttagGetHubsByOwnerId(data['_id'],
                                             request.COOKIES['access_token'])
        response_count = ttagRequestCount(data['_id'])
        counts = response_count['counts']

        key_name = "hub_id"
        if data_type == "id":
            from_time = 0 if 'from_time' not in request.POST else request.POST[
                'from_time']
            to_time = 4116171410000 if 'to_time' not in request.POST else request.POST[
                'to_time']
            items_per_page = 10000 if 'items_per_page' not in request.POST else request.POST[
                'items_per_page']
            page_number = 0 if 'page_number' not in request.POST else request.POST[
                'page_number']
            response = ttagGetHubUsers(data_value, from_time, to_time,
                                       items_per_page, page_number)

        if response["result"] == "OK":
            hub_users = response["data"]["hub_users"]
            #context = {'hub_users': response["data"]["hub_users"],key_name:data_value}
            thereturn = render_to_response(
                'hub/hub_members.html',
                locals(),
                context_instance=RequestContext(request))
            return thereturn
        else:
            return HttpResponse(response["msg"])
    else:
        return HttpResponseRedirect('/')
Ejemplo n.º 3
0
	def get_hub_member_names(self, request, from_time=0, to_time=4116171410000, items_per_page=10000, page_number=0):
		if self.hub_member_names == None:
			response = ttagGetHubUsers(self.hub_id, from_time, to_time, items_per_page, page_number)
			if "data" in response and "hub_users" in response["data"]:
				self.hub_member_names = [userData["user"]["user_name"] for userData in response["data"]["hub_users"]]
		return self.hub_member_names