don't crash if there's no current announcement
This commit is contained in:
parent
9698033353
commit
a175f67615
1 changed files with 1 additions and 1 deletions
|
@ -34,7 +34,7 @@ class Announcement(models.Model):
|
|||
result = None
|
||||
|
||||
timeout = 300
|
||||
if result.active_until:
|
||||
if result and result.active_until:
|
||||
timeout = max(0, min(timeout, (result.active_until-timezone.now()).total_seconds()))
|
||||
cache.set('site:announcement', result, timeout)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue