Skip to content

Commit

Permalink
Merge e906af1 into fafb3ac
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev-Destructor authored Sep 3, 2023
2 parents fafb3ac + e906af1 commit 83a325f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion stregsystem/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import random
from typing import List

import pytz
Expand Down Expand Up @@ -54,7 +55,8 @@

def __get_news():
try:
return News.objects.filter(stop_date__gte=timezone.now(), pub_date__lte=timezone.now()).get()
current_time = timezone.now()
return News.objects.filter(stop_date__gte=current_time, pub_date__lte=current_time).order_by('?').first()
except News.DoesNotExist:
return None

Expand Down

0 comments on commit 83a325f

Please sign in to comment.