Merge branch 'master' of github.com:Gluejar/regluit
commit
97daddea5d
|
@ -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
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -186,6 +186,13 @@ class CampaignListView(ListView):
|
|||
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"
|
||||
form_class = CampaignPledgeForm
|
||||
|
|
Loading…
Reference in New Issue