1 # Create your views here.
2 from django.views.generic import TemplateView
3 from .models import Offer
8 for stream, read_date in streams:
9 iterstream = iter(stream)
11 item = next(iterstream)
15 substreams.append([read_date(item), item, iterstream, read_date])
17 i, substream = max(enumerate(substreams), key=lambda x: x[0])
20 item = next(substream[2])
24 substream[0:2] = [substream[3](item), item]
27 class WLFundView(TemplateView):
28 template_name = "funding/wlfund.html"
30 def get_context_data(self):
31 ctx = super(WLFundView, self).get_context_data()
32 offers = [o for o in Offer.objects.all() if o.state() == 'lose' and o.sum()]
33 amount = sum(o.sum() for o in offers)
36 #offers = (o for o in Offer.objects.all() if o.state() == 'lose' and o.sum())
37 ctx['amount'] = amount
38 ctx['log'] = mix((offers, lambda x: x.end))