Merge pull request #178 from Gluejar/pubs_default_to_active

work lists with active campaigns should highlight them
pull/1/head
eshellman 2013-05-17 09:25:53 -07:00
commit a7a176ca3c
1 changed files with 8 additions and 3 deletions

View File

@ -615,15 +615,20 @@ class WorkListView(FilterableListView):
context['works_unglued'] = works_unglued.order_by('-campaigns__status', 'campaigns__deadline', '-num_wishes')[:self.max_works]
context['works_active'] = qs.filter(campaigns__status='ACTIVE').distinct()[:self.max_works]
context['works_wished'] = qs.exclude(editions__ebooks__isnull=False).exclude(campaigns__status='ACTIVE').exclude(campaigns__status='SUCCESSFUL').distinct()[:self.max_works]
context['activetab'] = "#3"
counts={}
counts['unglued'] = context['works_unglued'].count()
counts['unglueing'] = context['works_active'].count()
counts['wished'] = context['works_wished'].count()
context['counts'] = counts
if counts['unglueing']:
context['activetab'] = "#2"
elif counts['unglued']:
context['activetab'] = "#1"
else:
context['activetab'] = "#3"
return context
class ByPubView(WorkListView):