|
13 | 13 |
|
14 | 14 | from api.models import FeatureFlag
|
15 | 15 | from openstax.functions import build_image_url, build_document_url
|
16 |
| -from books.models import Book, SubjectBooks, BookFacultyResources, BookStudentResources |
| 16 | +from books.models import Book, SubjectBooks, BookFacultyResources, BookStudentResources, get_book_data |
17 | 17 | from webinars.models import Webinar
|
18 | 18 | from news.models import BlogStreamBlock # for use on the ImpactStories
|
19 | 19 |
|
@@ -2960,34 +2960,7 @@ def subjects(self):
|
2960 | 2960 | and category.subject_category in book.subject_categories \
|
2961 | 2961 | and book.book_state not in ['retired', 'unlisted']:
|
2962 | 2962 | book_data = []
|
2963 |
| - book_data.append({ |
2964 |
| - 'id': book.id, |
2965 |
| - 'slug': 'books/{}'.format(book.slug), |
2966 |
| - 'book_state': book.book_state, |
2967 |
| - 'title': book.title, |
2968 |
| - 'subjects': book.subjects(), |
2969 |
| - 'subject_categories': book.subject_categories, |
2970 |
| - 'k12subject': book.k12subjects(), |
2971 |
| - 'is_ap': book.is_ap, |
2972 |
| - 'cover_url': book.cover_url, |
2973 |
| - 'cover_color': book.cover_color, |
2974 |
| - 'high_resolution_pdf_url': book.high_resolution_pdf_url, |
2975 |
| - 'low_resolution_pdf_url': book.low_resolution_pdf_url, |
2976 |
| - 'ibook_link': book.ibook_link, |
2977 |
| - 'ibook_link_volume_2': book.ibook_link_volume_2, |
2978 |
| - 'webview_link': book.webview_link, |
2979 |
| - 'webview_rex_link': book.webview_rex_link, |
2980 |
| - 'bookshare_link': book.bookshare_link, |
2981 |
| - 'kindle_link': book.kindle_link, |
2982 |
| - 'amazon_coming_soon': book.amazon_coming_soon, |
2983 |
| - 'amazon_link': book.amazon_link, |
2984 |
| - 'bookstore_coming_soon': book.bookstore_coming_soon, |
2985 |
| - 'comp_copy_available': book.comp_copy_available, |
2986 |
| - 'salesforce_abbreviation': book.salesforce_abbreviation, |
2987 |
| - 'salesforce_name': book.salesforce_name, |
2988 |
| - 'urls': book.book_urls(), |
2989 |
| - 'last_updated_pdf': book.last_updated_pdf, |
2990 |
| - }) |
| 2963 | + book_data.append(get_book_data(book)) |
2991 | 2964 | books[book.title] = book_data
|
2992 | 2965 | book_list['category_description'] = category.description
|
2993 | 2966 | book_list['books'] = books
|
@@ -3156,35 +3129,7 @@ def books(self):
|
3156 | 3129 | if book.k12book_subjects is not None \
|
3157 | 3130 | and self.title in k12subjects \
|
3158 | 3131 | and book.book_state not in ['retired', 'draft']:
|
3159 |
| - book_data.append({ |
3160 |
| - 'id': book.id, |
3161 |
| - 'slug': 'books/{}'.format(book.slug), |
3162 |
| - 'title': book.title, |
3163 |
| - 'description': book.description, |
3164 |
| - 'cover_url': book.cover_url, |
3165 |
| - 'is_ap': book.is_ap, |
3166 |
| - 'is_hs': 'High School' in subjects, |
3167 |
| - 'cover_color': book.cover_color, |
3168 |
| - 'high_resolution_pdf_url': book.high_resolution_pdf_url, |
3169 |
| - 'low_resolution_pdf_url': book.low_resolution_pdf_url, |
3170 |
| - 'ibook_link': book.ibook_link, |
3171 |
| - 'ibook_link_volume_2': book.ibook_link_volume_2, |
3172 |
| - 'webview_link': book.webview_link, |
3173 |
| - 'webview_rex_link': book.webview_rex_link, |
3174 |
| - 'bookshare_link': book.bookshare_link, |
3175 |
| - 'kindle_link': book.kindle_link, |
3176 |
| - 'amazon_coming_soon': book.amazon_coming_soon, |
3177 |
| - 'amazon_link': book.amazon_link, |
3178 |
| - 'bookstore_coming_soon': book.bookstore_coming_soon, |
3179 |
| - 'comp_copy_available': book.comp_copy_available, |
3180 |
| - 'salesforce_abbreviation': book.salesforce_abbreviation, |
3181 |
| - 'salesforce_name': book.salesforce_name, |
3182 |
| - 'urls': book.book_urls(), |
3183 |
| - 'updated': book.updated, |
3184 |
| - 'created': book.created, |
3185 |
| - 'publish_date': book.publish_date, |
3186 |
| - 'last_updated_pdf': book.last_updated_pdf |
3187 |
| - }) |
| 3132 | + book_data.append(get_book_data(book)) |
3188 | 3133 | return book_data
|
3189 | 3134 |
|
3190 | 3135 | def student_resource_headers(self):
|
|
0 commit comments