Skip to content

Commit

Permalink
Fix 'str' object has no attribute 'year'
Browse files Browse the repository at this point in the history
  • Loading branch information
amakarudze committed Nov 24, 2023
1 parent 0632a98 commit b4addee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ __pycache__
/src
/include
.coverage
.venv
.venv/
venv/
static/media
.idea/*
.vscode
Expand Down
5 changes: 4 additions & 1 deletion core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def get_event(page_url, is_user_authenticated, is_preview):
event = Event.objects.filter(page_url=page_url).order_by("-date").first()

if not (is_user_authenticated or is_preview) and not event.is_page_live:
past = event.date <= now_approx
try:
past = event.date <= now_approx
except AttributeError:
past = True
return page_url, past

return event
Expand Down

0 comments on commit b4addee

Please sign in to comment.