+@register.simple_tag
+def club_active_yearly_count():
+ return Schedule.objects.filter(
+ expires_at__gt=now(),
+ yearly=True,
+ is_cancelled=False
+ ).count()
+
+@register.simple_tag
+def club_active_yearly_sum():
+ return Schedule.objects.filter(
+ expires_at__gt=now(),
+ yearly=True,
+ is_cancelled=False
+ ).aggregate(s=Sum('amount'))['s'] or 0
+
+@register.simple_tag
+def club_active_30day_count():
+ return Schedule.objects.filter(
+ yearly=False, monthly=False,
+ payed_at__gte=now() - timedelta(days=30)
+ ).count()
+
+@register.simple_tag
+def club_active_30day_sum():
+ return Schedule.objects.filter(
+ yearly=False, monthly=False,
+ payed_at__gte=now() - timedelta(days=30)
+ ).aggregate(s=Sum('amount'))['s'] or 0