Merge branch 'main' into book-format-choices

This commit is contained in:
Mouse Reeve
2021-08-04 14:13:55 -07:00
166 changed files with 7987 additions and 4136 deletions

View File

@ -1,6 +1,8 @@
""" database schema for books and shelves """
import re
from django.contrib.postgres.search import SearchVectorField
from django.contrib.postgres.indexes import GinIndex
from django.db import models
from django.dispatch import receiver
from model_utils import FieldTracker
@ -34,6 +36,7 @@ class BookDataModel(ObjectMixin, BookWyrmModel):
bnf_id = fields.CharField( # Bibliothèque nationale de France
max_length=255, blank=True, null=True, deduplication_field=True
)
search_vector = SearchVectorField(null=True)
last_edited_by = fields.ForeignKey(
"User",
@ -142,6 +145,11 @@ class Book(BookDataModel):
self.title,
)
class Meta:
"""sets up postgres GIN index field"""
indexes = (GinIndex(fields=["search_vector"]),)
class Work(OrderedCollectionPageMixin, Book):
"""a work (an abstract concept of a book that manifests in an edition)"""