Exemplo n.º 1
0
def circledetails(request, circlename):
    u = request.session.get('username','')
    circleobject = Circle.objects.get(circlename=circlename)
    circles = []
    circles.append(circlename)    
    users = getUsersInCircles(circles)
    ismember = False
    if u in users:
        ismember = True
        
    userobjects = User.objects.filter(username__in=users)
    items = Item.objects.filter(bookowner__in=userobjects)
    
    print "circlename " + circlename + "\n"
    print "circletype " + circleobject.circletype + "\n"
    print "userscount " + str(len(users)) + "\n"
    print "bookscount " + str(len(items)) + "\n"
    print "ismember " + str(ismember) + "\n"
    
    return render_to_response("circle.html",
        {"circlename":circlename,
         "circletype":circleobject.circletype,
         "userscount":len(users),
         "bookscount":len(items),
         "users":users,
         "ismember": ismember
     })
Exemplo n.º 2
0
def getCirclesForUserObject(userObject):
    circleusers = CircleUsers.objects.filter(user=userObject)
    circles = []
    for circleuserrow in circleusers:
        circles.append(circleuserrow.circle)
    return circles