From 30625283729285624d2bc7a4f02c5873d7466faa Mon Sep 17 00:00:00 2001 From: ed woodward Date: Mon, 30 Oct 2023 13:21:24 -0500 Subject: [PATCH] Subjects page filtering unlisted books --- books/migrations/0149_alter_book_book_state.py | 18 ++++++++++++++++++ pages/models.py | 2 +- .../0030_alter_erratacontent_book_state.py | 18 ++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 books/migrations/0149_alter_book_book_state.py create mode 100644 snippets/migrations/0030_alter_erratacontent_book_state.py diff --git a/books/migrations/0149_alter_book_book_state.py b/books/migrations/0149_alter_book_book_state.py new file mode 100644 index 000000000..e589a3474 --- /dev/null +++ b/books/migrations/0149_alter_book_book_state.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.7 on 2023-10-30 15:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('books', '0148_book_book_uuid_alter_book_cnx_id'), + ] + + operations = [ + migrations.AlterField( + model_name='book', + name='book_state', + field=models.CharField(choices=[('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)'), ('unlisted', 'Unlisted (Not included in books sent to site)')], default='live', help_text='The state of the book.', max_length=255), + ), + ] diff --git a/pages/models.py b/pages/models.py index e4326698d..0d9f449ac 100644 --- a/pages/models.py +++ b/pages/models.py @@ -2739,7 +2739,7 @@ def subjects(self): for book in all_books: if book.subject_categories is not None \ and category.subject_category in book.subject_categories \ - and book.book_state != 'retired': + and book.book_state not in ['retired', 'unlisted']: book_data = [] book_data.append({ 'id': book.id, diff --git a/snippets/migrations/0030_alter_erratacontent_book_state.py b/snippets/migrations/0030_alter_erratacontent_book_state.py new file mode 100644 index 000000000..3ea19bb30 --- /dev/null +++ b/snippets/migrations/0030_alter_erratacontent_book_state.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.7 on 2023-10-30 15:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('snippets', '0029_assignableavailable'), + ] + + operations = [ + migrations.AlterField( + model_name='erratacontent', + name='book_state', + field=models.CharField(choices=[('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)'), ('unlisted', 'Unlisted (Not included in books sent to site)')], default='live', help_text='The state of the book.', max_length=255), + ), + ]