Merge branch 'master' of github.com:Gluejar/regluit

pull/1/head
Ed Summers 2011-12-02 23:08:10 -05:00
commit 97daddea5d
3 changed files with 19 additions and 2 deletions

View File

@ -32,3 +32,12 @@ def work_list_users(work_list, how_many):
else :
user_list = work.wished_by()[0: how_many]
return user_list
def campaign_list_users(campaign_list, how_many):
users = User.objects.filter(wishlist__works__campaigns__in=campaign_list).distinct().reverse()
count = users.count()
if count <= how_many :
user_list = users[0: count]
else :
user_list = work.wished_by()[0: how_many]
return user_list

View File

@ -24,10 +24,11 @@
<div class="js-topnews2">
<div class="js-topnews3">
<div class="user-block">
<div class="user-block2">
<div class="user-block1">
<div class="block-intro-text">With your help we're trying to raise money to buy the right to give these books to the world.</div>
</div>
<div class="user-block4">
<div class="user-block2">
<span class="user-name"><a href="#">{{ facet|capfirst }}</a></span>
</div>
<div class="user-block3">
<div class="user-block">

View File

@ -185,6 +185,13 @@ class CampaignListView(ListView):
return models.Campaign.objects.filter(activated__isnull = False, suspended__isnull = True, withdrawn__isnull = True).order_by('deadline')
else:
return models.Campaign.objects.all()
def get_context_data(self, **kwargs):
context = super(CampaignListView, self).get_context_data(**kwargs)
qs=self.get_queryset()
context['ungluers'] = userlists.campaign_list_users(qs,5)
context['facet'] =self.kwargs['facet']
return context
class PledgeView(FormView):
template_name="pledge.html"