Skip to content

Commit

Permalink
Filtered out retired and draft tutor books (#1311)
Browse files Browse the repository at this point in the history
* Filtered out retired and draft tutor books

* Modified if stmt to be shorter
  • Loading branch information
edwoodward authored and mwvolo committed Jul 6, 2022
1 parent d6fa32c commit f21e97f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pages/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2564,12 +2564,13 @@ def tutor_books(self):
books = Book.objects.filter(tutor_marketing_book=True).order_by('path')
book_data = []
for book in books:
book_data.append({
'id': book.id,
'slug': 'books/{}'.format(book.slug),
'title': book.title,
'cover_url': book.cover_url,
})
if book.book_state not in ['Retired', 'Draft']:
book_data.append({
'id': book.id,
'slug': 'books/{}'.format(book.slug),
'title': book.title,
'cover_url': book.cover_url,
})
return book_data

@property
Expand Down

0 comments on commit f21e97f

Please sign in to comment.