From e7af18e04de51156c8d5e1314ddabab2c44ac9b9 Mon Sep 17 00:00:00 2001 From: ed woodward Date: Wed, 25 Oct 2023 12:59:12 -0500 Subject: [PATCH] Started adding unlisted book state --- books/constants.py | 4 +++- books/models.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/books/constants.py b/books/constants.py index ffd97fe33..3df9e02b0 100644 --- a/books/constants.py +++ b/books/constants.py @@ -3,12 +3,14 @@ NEW_EDITION_AVAILABLE = 'new_edition_available' DEPRECATED = 'deprecated' RETIRED = 'retired' +UNLISTED = 'unlisted' BOOK_STATES = ( (LIVE, 'Live'), (COMING_SOON, 'Coming Soon'), (NEW_EDITION_AVAILABLE, 'New Edition Forthcoming (Show new edition correction schedule)'), (DEPRECATED, 'Deprecated (Disallow errata submissions and show deprecated schedule)'), - (RETIRED, 'Retired (Remove from website)') + (RETIRED, 'Retired (Remove from website)'), + (UNLISTED, 'Unlisted (Not included in books sent to site)') ) YELLOW = 'yellow' diff --git a/books/models.py b/books/models.py index 8fcb9ddb7..2b35cddaf 100644 --- a/books/models.py +++ b/books/models.py @@ -994,7 +994,7 @@ class BookIndex(Page): @property def books(self): - books = Book.objects.live().filter(locale=self.locale).order_by('title') + books = Book.objects.live().filter(locale=self.locale).filter(self.book_state is not 'unlisted').order_by('title') book_data = [] for book in books: has_faculty_resources = BookFacultyResources.objects.filter(book_faculty_resource=book).exists()