|
|
|
|
@ -33,15 +33,14 @@ from qr_code.qrcode.utils import QRCodeOptions |
|
|
|
|
|
|
|
|
|
def index(request): |
|
|
|
|
|
|
|
|
|
today = date.today() |
|
|
|
|
tomorrow = today + timedelta(days=1) |
|
|
|
|
tomorrow = date.today() + timedelta(days=1) |
|
|
|
|
|
|
|
|
|
club_id = request.GET.get('club') |
|
|
|
|
q_is_private = Q(is_private=False) |
|
|
|
|
q_not_private = Q(is_private=False) |
|
|
|
|
|
|
|
|
|
q_after_tomorrow = [q_is_private, Q(end_date__isnull=True, start_date__gt=tomorrow)] |
|
|
|
|
q_after_today = [q_is_private, Q(end_date__isnull=True, start_date__gt=today)] |
|
|
|
|
q_ended = [q_is_private, Q(end_date__isnull=False)] |
|
|
|
|
q_after_tomorrow = [q_not_private, Q(end_date__isnull=True, start_date__gt=tomorrow)] |
|
|
|
|
q_unfinished = [q_not_private, Q(end_date__isnull=True)] |
|
|
|
|
q_ended = [q_not_private, Q(end_date__isnull=False)] |
|
|
|
|
|
|
|
|
|
club = None |
|
|
|
|
if club_id: |
|
|
|
|
@ -49,14 +48,14 @@ def index(request): |
|
|
|
|
|
|
|
|
|
q_club = Q(event__club=club) |
|
|
|
|
q_after_tomorrow.append(q_club) |
|
|
|
|
q_after_today.append(q_club) |
|
|
|
|
q_unfinished.append(q_club) |
|
|
|
|
q_ended.append(q_club) |
|
|
|
|
|
|
|
|
|
after_tomorrow_tournaments = Tournament.objects.filter(*q_after_tomorrow).order_by('start_date') |
|
|
|
|
after_today_tournaments = Tournament.objects.filter(*q_after_today).order_by('start_date') |
|
|
|
|
unfinished_tournaments = Tournament.objects.filter(*q_unfinished).order_by('start_date') |
|
|
|
|
|
|
|
|
|
live_tournaments = [] |
|
|
|
|
for tournament in after_today_tournaments: |
|
|
|
|
for tournament in unfinished_tournaments: |
|
|
|
|
if tournament.supposedly_in_progress(): |
|
|
|
|
live_tournaments.append(tournament) |
|
|
|
|
|
|
|
|
|
|