Skip to content

Commit

Permalink
geheim
Browse files Browse the repository at this point in the history
  • Loading branch information
autoantwort committed Jun 16, 2024
1 parent 6f06b9f commit 34a0498
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ def main_view(request):
bars = []
for day in Weekday.choices[:-3]:
bars.append((day[1], bars_by_weekday[day[0]]))
now = datetime.datetime.now()
events = Event.objects.filter(start_date__gte=datetime.date.today())
for event in events:
json_ld.append(event.to_json_ld())
# Check if it's a weekday (Monday=0, ..., Sunday=6) + if the time is between 6:00 and 19:00
now = datetime.datetime.now()
if 0 <= now.weekday() <= 4 and 6 <= now.hour < 19:
events = events.exclude(bar__name__icontains="symposion")
return render(request, 'main/main.html', {
Expand All @@ -99,6 +99,10 @@ def bar_view(request, bar_id, name):
events = bar.event_set.filter(start_date__gte=datetime.date.today())
for event in events:
json_ld.append(event.to_json_ld())
# Check if it's a weekday (Monday=0, ..., Sunday=6) + if the time is between 6:00 and 19:00
now = datetime.datetime.now()
if 0 <= now.weekday() <= 4 and 6 <= now.hour < 19:
events = events.exclude(bar__name__icontains="symposion")
return render(request, 'main/bar.html', {
'title': bar.name,
'json_ld': mark_safe(json.dumps(json_ld)),
Expand Down

0 comments on commit 34a0498

Please sign in to comment.