fix related expos

stage8
Slava 9 years ago
parent a2137fe6c6
commit 8041f376e0
  1. 15
      apps/functions/model_mixin.py

@ -5,6 +5,7 @@ from itertools import chain
from pytils.dt import ru_strftime
import datetime
from datetime import date
from dateutil.relativedelta import relativedelta
from django.conf import settings
@ -179,8 +180,18 @@ class EventMixin(object):
themes = list(self.theme.all().values_list('pk', flat=True))
top_paid = list(
model.objects.filter(
Q(top__isnull=False, theme__in=themes) |
Q(paid_new__isnull=False, theme__in=themes)
Q(
top__isnull=False,
theme__in=themes,
top__fr__lte=date.today(),
top__to__gte=date.today()
) |
Q(
paid_new__isnull=False,
theme__in=themes,
top__fr__lte=date.today(),
top__to__gte=date.today()
)
).filter(
is_published=True
).order_by('?')

Loading…
Cancel
Save