Skip to content

Commit

Permalink
Don't attempt to show siblings during preview. Fixes issue 29.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjsparks committed Jan 31, 2020
1 parent 5a5115e commit 27b9aa3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ietf/blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def date(self):
@property
def next(self):
siblings = self.siblings.exclude(pk=self.pk)
if not siblings:
if not siblings or not self.date:
return []
try:
return [
Expand All @@ -196,7 +196,7 @@ def next(self):
@property
def previous(self):
siblings = list(self.siblings.exclude(pk=self.pk))
if not siblings:
if not siblings or not self.date:
return []
try:
return [
Expand Down Expand Up @@ -250,7 +250,10 @@ def get_context(self, request, *args, **kwargs):
else:
filter_text = self.filter_topic.title

siblings = siblings.filter(d__lt=self.coalesced_published_date())[:5]
if self.coalesced_published_date():
siblings = siblings.filter(d__lt=self.coalesced_published_date() or datetime.now())[:5]
else:
siblings = siblings.none()

if filter_text:
if siblings:
Expand Down

0 comments on commit 27b9aa3

Please sign in to comment.