2011-11-14 20:16:12 +00:00
|
|
|
#put logic for retrieving userlists here
|
|
|
|
|
|
|
|
import random
|
2011-11-14 20:40:33 +00:00
|
|
|
from django.contrib.auth.models import User
|
|
|
|
from regluit.core.models import Work
|
2011-11-14 20:16:12 +00:00
|
|
|
|
|
|
|
def other_users(user, how_many):
|
|
|
|
# do something more sophisitcated sometime later
|
|
|
|
count = User.objects.all().count()
|
|
|
|
if count <= how_many :
|
|
|
|
user_list = User.objects.all()[0: count]
|
|
|
|
else :
|
|
|
|
slice = random.random() * (count - how_many)
|
|
|
|
user_list = User.objects.all()[slice: slice+how_many]
|
|
|
|
return user_list
|
2011-11-14 20:40:33 +00:00
|
|
|
|
|
|
|
def supporting_users(work, how_many):
|
|
|
|
# do something more sophisitcated sometime later
|
|
|
|
count = work.wished_by().count()
|
|
|
|
if count <= how_many :
|
|
|
|
user_list = work.wished_by()[0: count]
|
|
|
|
else :
|
|
|
|
slice = random.random() * (count - how_many)
|
|
|
|
user_list = work.wished_by()[slice: slice+how_many]
|
|
|
|
return user_list
|