diff --git a/bookwyrm/activitypub/book.py b/bookwyrm/activitypub/book.py index 7401a1346..e6a01b359 100644 --- a/bookwyrm/activitypub/book.py +++ b/bookwyrm/activitypub/book.py @@ -17,6 +17,8 @@ class BookData(ActivityObject): goodreadsKey: str = None bnfId: str = None viaf: str = None + wikidata: str = None + asin: str = None lastEditedBy: str = None links: List[str] = field(default_factory=lambda: []) fileLinks: List[str] = field(default_factory=lambda: []) @@ -28,8 +30,8 @@ class Book(BookData): """serializes an edition or work, abstract""" title: str - sortTitle: str = "" - subtitle: str = "" + sortTitle: str = None + subtitle: str = None description: str = "" languages: List[str] = field(default_factory=lambda: []) series: str = "" @@ -54,7 +56,6 @@ class Edition(Book): isbn10: str = "" isbn13: str = "" oclcNumber: str = "" - asin: str = "" pages: int = None physicalFormat: str = "" physicalFormatDetail: str = "" diff --git a/bookwyrm/migrations/0132_auto_20220130_1938.py b/bookwyrm/migrations/0132_auto_20220130_1938.py deleted file mode 100644 index a83ac2909..000000000 --- a/bookwyrm/migrations/0132_auto_20220130_1938.py +++ /dev/null @@ -1,42 +0,0 @@ -# Generated by Django 3.2.10 on 2022-01-30 19:38 - -import bookwyrm.models.fields -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ("bookwyrm", "0131_merge_20220125_1644"), - ] - - operations = [ - migrations.AddField( - model_name="author", - name="viaf", - field=bookwyrm.models.fields.CharField( - blank=True, max_length=255, null=True - ), - ), - migrations.AddField( - model_name="author", - name="wikidata", - field=bookwyrm.models.fields.CharField( - blank=True, max_length=255, null=True - ), - ), - migrations.AddField( - model_name="book", - name="viaf", - field=bookwyrm.models.fields.CharField( - blank=True, max_length=255, null=True - ), - ), - migrations.AddField( - model_name="book", - name="wikidata", - field=bookwyrm.models.fields.CharField( - blank=True, max_length=255, null=True - ), - ), - ] diff --git a/bookwyrm/migrations/0135_auto_20220217_1624.py b/bookwyrm/migrations/0135_auto_20220217_1624.py new file mode 100644 index 000000000..793cb5800 --- /dev/null +++ b/bookwyrm/migrations/0135_auto_20220217_1624.py @@ -0,0 +1,48 @@ +# Generated by Django 3.2.12 on 2022-02-17 16:24 + +import bookwyrm.models.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('bookwyrm', '0134_announcement_display_type'), + ] + + operations = [ + migrations.RenameField( + model_name='author', + old_name='viaf_id', + new_name='viaf', + ), + migrations.RemoveField( + model_name='edition', + name='asin', + ), + migrations.AddField( + model_name='author', + name='asin', + field=bookwyrm.models.fields.CharField(blank=True, max_length=255, null=True), + ), + migrations.AddField( + model_name='author', + name='wikidata', + field=bookwyrm.models.fields.CharField(blank=True, max_length=255, null=True), + ), + migrations.AddField( + model_name='book', + name='asin', + field=bookwyrm.models.fields.CharField(blank=True, max_length=255, null=True), + ), + migrations.AddField( + model_name='book', + name='viaf', + field=bookwyrm.models.fields.CharField(blank=True, max_length=255, null=True), + ), + migrations.AddField( + model_name='book', + name='wikidata', + field=bookwyrm.models.fields.CharField(blank=True, max_length=255, null=True), + ), + ] diff --git a/bookwyrm/models/author.py b/bookwyrm/models/author.py index 5edac57d5..78d153a21 100644 --- a/bookwyrm/models/author.py +++ b/bookwyrm/models/author.py @@ -21,9 +21,6 @@ class Author(BookDataModel): isni = fields.CharField( max_length=255, blank=True, null=True, deduplication_field=True ) - viaf_id = fields.CharField( - max_length=255, blank=True, null=True, deduplication_field=True - ) gutenberg_id = fields.CharField( max_length=255, blank=True, null=True, deduplication_field=True ) diff --git a/bookwyrm/models/book.py b/bookwyrm/models/book.py index c796b7d24..3ea8e1a8e 100644 --- a/bookwyrm/models/book.py +++ b/bookwyrm/models/book.py @@ -52,6 +52,9 @@ class BookDataModel(ObjectMixin, BookWyrmModel): wikidata = fields.CharField( max_length=255, blank=True, null=True, deduplication_field=True ) + asin = fields.CharField( + max_length=255, blank=True, null=True, deduplication_field=True + ) search_vector = SearchVectorField(null=True) last_edited_by = fields.ForeignKey( @@ -277,9 +280,6 @@ class Edition(Book): oclc_number = fields.CharField( max_length=255, blank=True, null=True, deduplication_field=True ) - asin = fields.CharField( - max_length=255, blank=True, null=True, deduplication_field=True - ) pages = fields.IntegerField(blank=True, null=True) physical_format = fields.CharField( max_length=255, choices=FormatChoices, null=True, blank=True