Merge branch 'main' into production

This commit is contained in:
Mouse Reeve 2020-11-04 11:31:01 -08:00
commit c577c91912
77 changed files with 1191 additions and 2067 deletions

View file

@ -20,11 +20,11 @@ class Note(ActivityObject):
inReplyTo: str
published: str
attributedTo: str
tag: List[Link]
to: List[str]
cc: List[str]
content: str
replies: Dict
tag: List[Link] = field(default=lambda: [])
attachment: List[Image] = field(default=lambda: [])
sensitive: bool = False
type: str = 'Note'

View file

@ -128,9 +128,10 @@ class AbstractConnector(ABC):
if not edition:
ed_key = self.get_remote_id_from_data(edition_data)
edition = self.create_book(ed_key, edition_data, models.Edition)
edition.default = True
edition.parent_work = work
edition.save()
work.default_edition = edition
work.save()
# now's our change to fill in author gaps
if not edition.authors and work.authors:

View file

@ -72,7 +72,6 @@ class Connector(AbstractConnector):
]
def get_remote_id_from_data(self, data):
try:
key = data['key']

View file

@ -1,5 +1,6 @@
''' using a bookwyrm instance as a source of book data '''
from django.contrib.postgres.search import SearchRank, SearchVector
from django.db.models import F
from bookwyrm import models
from .abstract_connector import AbstractConnector, SearchResult
@ -30,7 +31,10 @@ class Connector(AbstractConnector):
).filter(
rank__gt=min_confidence
).order_by('-rank')
results = results.filter(default=True) or results
# remove non-default editions, if possible
results = results.filter(parent_work__default_edition__id=F('id')) \
or results
search_results = []
for book in results[:10]:

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.3 on 2020-02-21 17:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0005_auto_20200221_1645'),
]
operations = [
migrations.AlterField(
model_name='tag',
name='identifier',
field=models.CharField(max_length=100),
),
]

File diff suppressed because it is too large Load diff

View file

@ -1,17 +0,0 @@
# Generated by Django 3.0.3 on 2020-02-23 09:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0006_auto_20200221_1702'),
]
operations = [
migrations.AddConstraint(
model_name='userrelationship',
constraint=models.UniqueConstraint(fields=('user_subject', 'user_object'), name='followers_unique'),
),
]

View file

@ -1,4 +1,4 @@
# Generated by Django 3.0.3 on 2020-06-02 15:46
# Generated by Django 3.0.7 on 2020-11-03 00:14
from django.conf import settings
from django.db import migrations, models
@ -8,14 +8,13 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0043_siteinvite'),
('bookwyrm', '0006_auto_20200221_1702_squashed_0064_merge_20201101_1913'),
]
operations = [
migrations.AddField(
migrations.AlterField(
model_name='siteinvite',
name='user',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
preserve_default=False,
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
]

View file

@ -1,19 +0,0 @@
# Generated by Django 3.0.3 on 2020-02-24 15:04
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0007_auto_20200223_0902'),
]
operations = [
migrations.AlterField(
model_name='user',
name='followers',
field=models.ManyToManyField(related_name='following', through='bookwyrm.UserRelationship', to=settings.AUTH_USER_MODEL),
),
]

View file

@ -0,0 +1,35 @@
# Generated by Django 3.0.7 on 2020-11-04 18:15
from django.db import migrations, models
import django.db.models.deletion
def set_default_edition(app_registry, schema_editor):
db_alias = schema_editor.connection.alias
works = app_registry.get_model('bookwyrm', 'Work').objects.using(db_alias)
editions = app_registry.get_model('bookwyrm', 'Edition').objects.using(db_alias)
for work in works:
ed = editions.filter(parent_work=work, default=True).first()
if not ed:
ed = editions.filter(parent_work=work).first()
work.default_edition = ed
work.save()
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0007_auto_20201103_0014'),
]
operations = [
migrations.AddField(
model_name='work',
name='default_edition',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Edition'),
),
migrations.RunPython(set_default_edition),
migrations.RemoveField(
model_name='edition',
name='default',
),
]

View file

@ -1,19 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-07 00:28
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0008_auto_20200224_1504'),
]
operations = [
migrations.AddField(
model_name='status',
name='published_date',
field=models.DateTimeField(default=datetime.datetime.now),
),
]

View file

@ -1,190 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-07 06:55
import datetime
from django.db import migrations, models
import django.db.models.deletion
import bookwyrm.utils.fields
import uuid
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0009_status_published_date'),
]
operations = [
migrations.CreateModel(
name='Edition',
fields=[
('book_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='bookwyrm.Book')),
('isbn', models.CharField(max_length=255, null=True, unique=True)),
('oclc_number', models.CharField(max_length=255, null=True, unique=True)),
('pages', models.IntegerField(null=True)),
],
options={
'abstract': False,
},
bases=('bookwyrm.book',),
),
migrations.CreateModel(
name='Work',
fields=[
('book_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='bookwyrm.Book')),
('lccn', models.CharField(max_length=255, null=True, unique=True)),
],
options={
'abstract': False,
},
bases=('bookwyrm.book',),
),
migrations.RemoveField(
model_name='author',
name='data',
),
migrations.RemoveField(
model_name='book',
name='added_by',
),
migrations.RemoveField(
model_name='book',
name='data',
),
migrations.AddField(
model_name='author',
name='aliases',
field=bookwyrm.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, size=None),
),
migrations.AddField(
model_name='author',
name='bio',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='author',
name='born',
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name='author',
name='died',
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name='author',
name='first_name',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='author',
name='last_name',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='author',
name='name',
field=models.CharField(default='Unknown', max_length=255),
preserve_default=False,
),
migrations.AddField(
model_name='author',
name='wikipedia_link',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='book',
name='description',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='book',
name='first_published_date',
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name='book',
name='language',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='book',
name='last_sync_date',
field=models.DateTimeField(default=datetime.datetime.now),
),
migrations.AddField(
model_name='book',
name='librarything_key',
field=models.CharField(max_length=255, null=True, unique=True),
),
migrations.AddField(
model_name='book',
name='local_edits',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='book',
name='local_key',
field=models.CharField(default=uuid.uuid4, max_length=255, unique=True),
),
migrations.AddField(
model_name='book',
name='misc_identifiers',
field=bookwyrm.utils.fields.JSONField(null=True),
),
migrations.AddField(
model_name='book',
name='origin',
field=models.CharField(max_length=255, null=True, unique=True),
),
migrations.AddField(
model_name='book',
name='published_date',
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name='book',
name='series',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='book',
name='series_number',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='book',
name='sort_title',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='book',
name='subtitle',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='book',
name='sync',
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name='book',
name='title',
field=models.CharField(default='Unknown', max_length=255),
preserve_default=False,
),
migrations.AlterField(
model_name='author',
name='openlibrary_key',
field=models.CharField(max_length=255, null=True, unique=True),
),
migrations.AlterField(
model_name='book',
name='openlibrary_key',
field=models.CharField(max_length=255, null=True, unique=True),
),
migrations.AddField(
model_name='book',
name='parent_work',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Work'),
),
]

View file

@ -1,32 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-07 22:23
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0010_auto_20200307_0655'),
]
operations = [
migrations.CreateModel(
name='Notification',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_date', models.DateTimeField(auto_now_add=True)),
('updated_date', models.DateTimeField(auto_now=True)),
('read', models.BooleanField(default=False)),
('notification_type', models.CharField(max_length=255)),
('related_book', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Book')),
('related_status', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Status')),
('related_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='related_user', to=settings.AUTH_USER_MODEL)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
),
]

View file

@ -1,19 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-08 16:25
from django.db import migrations, models
import bookwyrm.utils.fields
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0011_notification'),
]
operations = [
migrations.AlterField(
model_name='author',
name='aliases',
field=bookwyrm.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-09 20:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0012_auto_20200308_1625'),
]
operations = [
migrations.AddField(
model_name='user',
name='manually_approves_followers',
field=models.BooleanField(default=False),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-10 19:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0013_user_manually_approves_followers'),
]
operations = [
migrations.AddField(
model_name='status',
name='remote_id',
field=models.CharField(max_length=255, null=True, unique=True),
),
]

View file

@ -1,115 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-11 12:12
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0014_status_remote_id'),
]
operations = [
migrations.CreateModel(
name='UserBlocks',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_date', models.DateTimeField(auto_now_add=True)),
('updated_date', models.DateTimeField(auto_now=True)),
('relationship_id', models.CharField(max_length=100)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='UserFollowRequest',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_date', models.DateTimeField(auto_now_add=True)),
('updated_date', models.DateTimeField(auto_now=True)),
('relationship_id', models.CharField(max_length=100)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='UserFollows',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_date', models.DateTimeField(auto_now_add=True)),
('updated_date', models.DateTimeField(auto_now=True)),
('relationship_id', models.CharField(max_length=100)),
],
options={
'abstract': False,
},
),
migrations.RemoveField(
model_name='user',
name='followers',
),
migrations.DeleteModel(
name='UserRelationship',
),
migrations.AddField(
model_name='userfollows',
name='user_object',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='userfollows_user_object', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='userfollows',
name='user_subject',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='userfollows_user_subject', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='userfollowrequest',
name='user_object',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='userfollowrequest_user_object', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='userfollowrequest',
name='user_subject',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='userfollowrequest_user_subject', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='userblocks',
name='user_object',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='userblocks_user_object', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='userblocks',
name='user_subject',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='userblocks_user_subject', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='user',
name='blocks',
field=models.ManyToManyField(related_name='blocked_by', through='bookwyrm.UserBlocks', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='user',
name='follow_requests',
field=models.ManyToManyField(related_name='follower_requests', through='bookwyrm.UserFollowRequest', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='user',
name='following',
field=models.ManyToManyField(related_name='followers', through='bookwyrm.UserFollows', to=settings.AUTH_USER_MODEL),
),
migrations.AddConstraint(
model_name='userfollows',
constraint=models.UniqueConstraint(fields=('user_subject', 'user_object'), name='userfollows_unique'),
),
migrations.AddConstraint(
model_name='userfollowrequest',
constraint=models.UniqueConstraint(fields=('user_subject', 'user_object'), name='userfollowrequest_unique'),
),
migrations.AddConstraint(
model_name='userblocks',
constraint=models.UniqueConstraint(fields=('user_subject', 'user_object'), name='userblocks_unique'),
),
]

View file

@ -1,22 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-13 13:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0015_auto_20200311_1212'),
]
operations = [
migrations.AlterField(
model_name='notification',
name='notification_type',
field=models.CharField(choices=[('FAVORITE', 'Favorite'), ('REPLY', 'Reply'), ('TAG', 'Tag'), ('FOLLOW', 'Follow'), ('FOLLOW_REQUEST', 'Follow Request')], max_length=255),
),
migrations.AddConstraint(
model_name='notification',
constraint=models.CheckConstraint(check=models.Q(notification_type__in=['FAVORITE', 'REPLY', 'TAG', 'FOLLOW', 'FOLLOW_REQUEST']), name='notification_type_valid'),
),
]

View file

@ -1,26 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-14 21:52
from django.db import migrations, models
import django.db.models.expressions
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0016_auto_20200313_1337'),
]
operations = [
migrations.AddConstraint(
model_name='userblocks',
constraint=models.CheckConstraint(check=models.Q(_negated=True, user_subject=django.db.models.expressions.F('user_object')), name='userblocks_no_self'),
),
migrations.AddConstraint(
model_name='userfollowrequest',
constraint=models.CheckConstraint(check=models.Q(_negated=True, user_subject=django.db.models.expressions.F('user_object')), name='userfollowrequest_no_self'),
),
migrations.AddConstraint(
model_name='userfollows',
constraint=models.CheckConstraint(check=models.Q(_negated=True, user_subject=django.db.models.expressions.F('user_object')), name='userfollows_no_self'),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-21 21:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0017_auto_20200314_2152'),
]
operations = [
migrations.AddField(
model_name='favorite',
name='remote_id',
field=models.CharField(max_length=255, null=True, unique=True),
),
]

View file

@ -1,26 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-21 22:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0018_favorite_remote_id'),
]
operations = [
migrations.CreateModel(
name='Comment',
fields=[
('status_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='bookwyrm.Status')),
('name', models.CharField(max_length=255)),
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Book')),
],
options={
'abstract': False,
},
bases=('bookwyrm.status',),
),
]

View file

@ -1,58 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-27 23:35
from django.db import migrations, models
import django.db.models.deletion
import bookwyrm.models.book
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0019_comment'),
]
operations = [
migrations.CreateModel(
name='Connector',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_date', models.DateTimeField(auto_now_add=True)),
('updated_date', models.DateTimeField(auto_now=True)),
('identifier', models.CharField(max_length=255, unique=True)),
('connector_file', models.CharField(choices=[('openlibrary', 'Openlibrary'), ('bookwyrm', 'BookWyrm')], default='openlibrary', max_length=255)),
('is_self', models.BooleanField(default=False)),
('api_key', models.CharField(max_length=255, null=True)),
('base_url', models.CharField(max_length=255)),
('covers_url', models.CharField(max_length=255)),
('search_url', models.CharField(max_length=255, null=True)),
('key_name', models.CharField(max_length=255)),
('politeness_delay', models.IntegerField(null=True)),
('max_query_count', models.IntegerField(null=True)),
('query_count', models.IntegerField(default=0)),
('query_count_expiry', models.DateTimeField(auto_now_add=True)),
],
),
migrations.RenameField(
model_name='book',
old_name='local_key',
new_name='fedireads_key',
),
migrations.RenameField(
model_name='book',
old_name='origin',
new_name='source_url',
),
migrations.RemoveField(
model_name='book',
name='local_edits',
),
migrations.AddConstraint(
model_name='connector',
constraint=models.CheckConstraint(check=models.Q(connector_file__in=bookwyrm.models.connector.ConnectorFiles), name='connector_file_valid'),
),
migrations.AddField(
model_name='book',
name='connector',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Connector'),
),
]

View file

@ -1,44 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-28 04:28
from django.db import migrations, models
import bookwyrm.utils.fields
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0020_auto_20200327_2335'),
]
operations = [
migrations.AddField(
model_name='book',
name='goodreads_key',
field=models.CharField(max_length=255, null=True, unique=True),
),
migrations.AddField(
model_name='book',
name='subject_places',
field=bookwyrm.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None),
),
migrations.AddField(
model_name='book',
name='subjects',
field=bookwyrm.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None),
),
migrations.AddField(
model_name='edition',
name='physical_format',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='edition',
name='publishers',
field=bookwyrm.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None),
),
migrations.AlterField(
model_name='connector',
name='connector_file',
field=models.CharField(choices=[('openlibrary', 'Openlibrary'), ('fedireads_connector', 'Fedireads Connector')], default='openlibrary', max_length=255),
),
]

View file

@ -1,27 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-28 20:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0021_auto_20200328_0428'),
]
operations = [
migrations.RemoveField(
model_name='connector',
name='is_self',
),
migrations.AddField(
model_name='author',
name='fedireads_key',
field=models.CharField(max_length=255, null=True, unique=True),
),
migrations.AlterField(
model_name='connector',
name='connector_file',
field=models.CharField(choices=[('openlibrary', 'Openlibrary'), ('self_connector', 'Self Connector'), ('fedireads_connector', 'Fedireads Connector')], default='openlibrary', max_length=255),
),
]

View file

@ -1,114 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-28 22:03
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0022_auto_20200328_2001'),
]
operations = [
migrations.AddField(
model_name='book',
name='sync_cover',
field=models.BooleanField(default=True),
),
migrations.AlterField(
model_name='author',
name='born',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AlterField(
model_name='author',
name='died',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AlterField(
model_name='author',
name='fedireads_key',
field=models.CharField(default=uuid.uuid4, max_length=255, unique=True),
),
migrations.AlterField(
model_name='author',
name='first_name',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='author',
name='last_name',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='author',
name='openlibrary_key',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='book',
name='first_published_date',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AlterField(
model_name='book',
name='goodreads_key',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='book',
name='language',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='book',
name='librarything_key',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='book',
name='openlibrary_key',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='book',
name='published_date',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AlterField(
model_name='book',
name='sort_title',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='book',
name='subtitle',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='edition',
name='isbn',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='edition',
name='oclc_number',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='edition',
name='pages',
field=models.IntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name='edition',
name='physical_format',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='work',
name='lccn',
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-29 22:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0023_auto_20200328_2203'),
]
operations = [
migrations.AddField(
model_name='federatedserver',
name='application_version',
field=models.CharField(max_length=255, null=True),
),
]

View file

@ -1,24 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-30 00:37
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0024_federatedserver_application_version'),
]
operations = [
migrations.AlterField(
model_name='book',
name='last_sync_date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='status',
name='published_date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
]

View file

@ -1,42 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-30 14:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0025_auto_20200330_0037'),
]
operations = [
migrations.CreateModel(
name='Boost',
fields=[
('status_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='bookwyrm.Status')),
],
options={
'abstract': False,
},
bases=('bookwyrm.status',),
),
migrations.RemoveConstraint(
model_name='notification',
name='notification_type_valid',
),
migrations.AlterField(
model_name='notification',
name='notification_type',
field=models.CharField(choices=[('FAVORITE', 'Favorite'), ('REPLY', 'Reply'), ('TAG', 'Tag'), ('FOLLOW', 'Follow'), ('FOLLOW_REQUEST', 'Follow Request'), ('BOOST', 'Boost')], max_length=255),
),
migrations.AddConstraint(
model_name='notification',
constraint=models.CheckConstraint(check=models.Q(notification_type__in=['FAVORITE', 'REPLY', 'TAG', 'FOLLOW', 'FOLLOW_REQUEST', 'BOOST']), name='notification_type_valid'),
),
migrations.AddField(
model_name='boost',
name='boosted_status',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='boosters', to='bookwyrm.Status'),
),
]

View file

@ -1,82 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-30 22:32
from django.db import migrations, models
import django.db.models.deletion
import bookwyrm.utils.fields
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0026_auto_20200330_1456'),
]
operations = [
migrations.RemoveField(
model_name='book',
name='language',
),
migrations.RemoveField(
model_name='book',
name='parent_work',
),
migrations.RemoveField(
model_name='book',
name='shelves',
),
migrations.AddField(
model_name='book',
name='languages',
field=bookwyrm.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None),
),
migrations.AddField(
model_name='edition',
name='default',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='edition',
name='parent_work',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Work'),
),
migrations.AddField(
model_name='edition',
name='shelves',
field=models.ManyToManyField(through='bookwyrm.ShelfBook', to='bookwyrm.Shelf'),
),
migrations.AlterField(
model_name='comment',
name='book',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Edition'),
),
migrations.AlterField(
model_name='notification',
name='related_book',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Edition'),
),
migrations.AlterField(
model_name='review',
name='book',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Edition'),
),
migrations.AlterField(
model_name='shelf',
name='books',
field=models.ManyToManyField(through='bookwyrm.ShelfBook', to='bookwyrm.Edition'),
),
migrations.AlterField(
model_name='shelfbook',
name='book',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Edition'),
),
migrations.AlterField(
model_name='status',
name='mention_books',
field=models.ManyToManyField(related_name='mention_book', to='bookwyrm.Edition'),
),
migrations.AlterField(
model_name='tag',
name='book',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Edition'),
),
]

View file

@ -1,23 +0,0 @@
# Generated by Django 3.0.3 on 2020-04-01 18:24
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0027_auto_20200330_2232'),
]
operations = [
migrations.RemoveField(
model_name='comment',
name='name',
),
migrations.AlterField(
model_name='review',
name='rating',
field=models.IntegerField(blank=True, default=None, null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(5)]),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.3 on 2020-04-03 18:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0028_auto_20200401_1824'),
]
operations = [
migrations.AlterField(
model_name='review',
name='name',
field=models.CharField(max_length=255, null=True),
),
]

View file

@ -1,26 +0,0 @@
# Generated by Django 3.0.3 on 2020-04-07 00:51
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0029_auto_20200403_1835'),
]
operations = [
migrations.CreateModel(
name='Quotation',
fields=[
('status_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='bookwyrm.Status')),
('quote', models.TextField()),
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Edition')),
],
options={
'abstract': False,
},
bases=('bookwyrm.status',),
),
]

View file

@ -1,31 +0,0 @@
# Generated by Django 3.0.3 on 2020-04-15 12:24
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0030_quotation'),
]
operations = [
migrations.CreateModel(
name='ReadThrough',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_date', models.DateTimeField(auto_now_add=True)),
('updated_date', models.DateTimeField(auto_now=True)),
('pages_read', models.IntegerField(blank=True, null=True)),
('start_date', models.DateTimeField(blank=True, null=True)),
('finish_date', models.DateTimeField(blank=True, null=True)),
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Book')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
),
]

View file

@ -1,60 +0,0 @@
# Generated by Django 3.0.3 on 2020-04-21 13:47
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import bookwyrm.utils.fields
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0031_readthrough'),
]
operations = [
migrations.CreateModel(
name='ImportItem',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('data', bookwyrm.utils.fields.JSONField()),
],
),
migrations.CreateModel(
name='ImportJob',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_date', models.DateTimeField(default=django.utils.timezone.now)),
('task_id', models.CharField(max_length=100, null=True)),
],
),
migrations.RemoveConstraint(
model_name='notification',
name='notification_type_valid',
),
migrations.AlterField(
model_name='notification',
name='notification_type',
field=models.CharField(choices=[('FAVORITE', 'Favorite'), ('REPLY', 'Reply'), ('TAG', 'Tag'), ('FOLLOW', 'Follow'), ('FOLLOW_REQUEST', 'Follow Request'), ('BOOST', 'Boost'), ('IMPORT_RESULT', 'Import Result')], max_length=255),
),
migrations.AddConstraint(
model_name='notification',
constraint=models.CheckConstraint(check=models.Q(notification_type__in=['FAVORITE', 'REPLY', 'TAG', 'FOLLOW', 'FOLLOW_REQUEST', 'BOOST', 'IMPORT_RESULT']), name='notification_type_valid'),
),
migrations.AddField(
model_name='importjob',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='importitem',
name='book',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='bookwyrm.Book'),
),
migrations.AddField(
model_name='importitem',
name='job',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='bookwyrm.ImportJob'),
),
]

View file

@ -1,43 +0,0 @@
# Generated by Django 3.0.3 on 2020-04-22 12:49
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0032_auto_20200421_1347'),
]
operations = [
migrations.RemoveConstraint(
model_name='notification',
name='notification_type_valid',
),
migrations.AddField(
model_name='importitem',
name='fail_reason',
field=models.TextField(null=True),
),
migrations.AddField(
model_name='importitem',
name='index',
field=models.IntegerField(default=1),
preserve_default=False,
),
migrations.AddField(
model_name='notification',
name='related_import',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.ImportJob'),
),
migrations.AlterField(
model_name='notification',
name='notification_type',
field=models.CharField(choices=[('FAVORITE', 'Favorite'), ('REPLY', 'Reply'), ('TAG', 'Tag'), ('FOLLOW', 'Follow'), ('FOLLOW_REQUEST', 'Follow Request'), ('BOOST', 'Boost'), ('IMPORT', 'Import')], max_length=255),
),
migrations.AddConstraint(
model_name='notification',
constraint=models.CheckConstraint(check=models.Q(notification_type__in=['FAVORITE', 'REPLY', 'TAG', 'FOLLOW', 'FOLLOW_REQUEST', 'BOOST', 'IMPORT']), name='notification_type_valid'),
),
]

View file

@ -1,19 +0,0 @@
# Generated by Django 3.0.3 on 2020-04-22 13:12
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0033_auto_20200422_1249'),
]
operations = [
migrations.AddField(
model_name='importjob',
name='import_status',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Status'),
),
]

View file

@ -1,33 +0,0 @@
# Generated by Django 3.0.3 on 2020-04-29 17:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0034_importjob_import_status'),
]
operations = [
migrations.RenameField(
model_name='edition',
old_name='isbn',
new_name='isbn_13',
),
migrations.AddField(
model_name='book',
name='author_text',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='edition',
name='asin',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='edition',
name='isbn_10',
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View file

@ -1,39 +0,0 @@
# Generated by Django 3.0.3 on 2020-05-03 20:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0035_auto_20200429_1708'),
]
operations = [
migrations.AddField(
model_name='connector',
name='books_url',
field=models.CharField(default='https://openlibrary.org', max_length=255),
preserve_default=False,
),
migrations.AddField(
model_name='connector',
name='local',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='connector',
name='name',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='connector',
name='priority',
field=models.IntegerField(default=2),
),
migrations.AlterField(
model_name='connector',
name='connector_file',
field=models.CharField(choices=[('openlibrary', 'Openlibrary'), ('self_connector', 'Self Connector'), ('fedireads_connector', 'Fedireads Connector')], max_length=255),
),
]

View file

@ -1,41 +0,0 @@
# Generated by Django 3.0.3 on 2020-05-04 01:54
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0036_auto_20200503_2007'),
]
operations = [
migrations.RemoveField(
model_name='author',
name='fedireads_key',
),
migrations.RemoveField(
model_name='book',
name='fedireads_key',
),
migrations.RemoveField(
model_name='book',
name='source_url',
),
migrations.AddField(
model_name='author',
name='last_sync_date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AddField(
model_name='author',
name='sync',
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name='book',
name='remote_id',
field=models.CharField(max_length=255, null=True),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.3 on 2020-05-09 19:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0037_auto_20200504_0154'),
]
operations = [
migrations.AddField(
model_name='author',
name='remote_id',
field=models.CharField(max_length=255, null=True),
),
]

View file

@ -1,21 +0,0 @@
# Generated by Django 3.0.3 on 2020-05-10 23:42
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0038_author_remote_id'),
]
operations = [
migrations.RemoveField(
model_name='book',
name='misc_identifiers',
),
migrations.RemoveField(
model_name='connector',
name='key_name',
),
]

View file

@ -1,77 +0,0 @@
# Generated by Django 3.0.3 on 2020-05-13 01:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0039_auto_20200510_2342'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='actor',
),
migrations.AddField(
model_name='connector',
name='remote_id',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='federatedserver',
name='remote_id',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='notification',
name='remote_id',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='readthrough',
name='remote_id',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='shelf',
name='remote_id',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='shelfbook',
name='remote_id',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='tag',
name='remote_id',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='userblocks',
name='remote_id',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='userfollowrequest',
name='remote_id',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='userfollows',
name='remote_id',
field=models.CharField(max_length=255, null=True),
),
migrations.AlterField(
model_name='favorite',
name='remote_id',
field=models.CharField(max_length=255, null=True),
),
migrations.AlterField(
model_name='status',
name='remote_id',
field=models.CharField(max_length=255, null=True),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.3 on 2020-05-13 02:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0040_auto_20200513_0153'),
]
operations = [
migrations.AddField(
model_name='user',
name='remote_id',
field=models.CharField(max_length=255, null=True, unique=True),
),
]

View file

@ -1,21 +0,0 @@
# Generated by Django 3.0.3 on 2020-05-24 03:46
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0041_user_remote_id'),
]
operations = [
migrations.RemoveField(
model_name='status',
name='activity_type',
),
migrations.RemoveField(
model_name='status',
name='status_type',
),
]

View file

@ -1,23 +0,0 @@
# Generated by Django 3.0.3 on 2020-06-01 18:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0041_user_remote_id'),
]
operations = [
migrations.CreateModel(
name='SiteSettings',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(default='wyrms.cthulahoops.org', max_length=100)),
('instance_description', models.TextField(default='This instance has no description.')),
('code_of_conduct', models.TextField(default='Add a code of conduct here.')),
('allow_registration', models.BooleanField(default=True)),
],
),
]

View file

@ -1,24 +0,0 @@
# Generated by Django 3.0.3 on 2020-06-01 21:31
from django.db import migrations, models
import bookwyrm.models.site
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0042_sitesettings'),
]
operations = [
migrations.CreateModel(
name='SiteInvite',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(default=bookwyrm.models.site.new_access_code, max_length=32)),
('expiry', models.DateTimeField(blank=True, null=True)),
('use_limit', models.IntegerField(blank=True, null=True)),
('times_used', models.IntegerField(default=0)),
],
),
]

View file

@ -1,14 +0,0 @@
# Generated by Django 3.0.7 on 2020-08-10 20:10
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0044_siteinvite_user'),
('bookwyrm', '0042_auto_20200524_0346'),
]
operations = [
]

View file

@ -1,28 +0,0 @@
# Generated by Django 3.0.7 on 2020-09-21 15:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0045_merge_20200810_2010'),
]
operations = [
migrations.RenameField(
model_name='user',
old_name='fedireads_user',
new_name='bookwyrm_user',
),
migrations.AlterField(
model_name='connector',
name='connector_file',
field=models.CharField(choices=[('openlibrary', 'Openlibrary'), ('self_connector', 'Self Connector'), ('bookwyrm_connector', 'BookWyrm Connector')], max_length=255),
),
migrations.AlterField(
model_name='sitesettings',
name='name',
field=models.CharField(default='1d8390fd.ngrok.io', max_length=100),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.7 on 2020-09-28 23:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0046_auto_20200921_1509'),
]
operations = [
migrations.AlterField(
model_name='connector',
name='connector_file',
field=models.CharField(choices=[('openlibrary', 'Openlibrary'), ('self_connector', 'Self Connector'), ('bookwyrm_connector', 'Bookwyrm Connector')], max_length=255),
),
]

View file

@ -1,24 +0,0 @@
# Generated by Django 3.0.7 on 2020-09-29 00:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0047_auto_20200928_2312'),
]
operations = [
migrations.CreateModel(
name='GeneratedStatus',
fields=[
('status_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='bookwyrm.Status')),
],
options={
'abstract': False,
},
bases=('bookwyrm.status',),
),
]

View file

@ -1,25 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-02 19:43
import bookwyrm.models.site
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0048_generatednote'),
]
operations = [
migrations.CreateModel(
name='PasswordReset',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(default=bookwyrm.models.site.new_access_code, max_length=32)),
('expiry', models.DateTimeField(default=bookwyrm.models.site.get_passowrd_reset_expiry)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-02 21:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0049_passwordreset'),
]
operations = [
migrations.AlterField(
model_name='user',
name='email',
field=models.EmailField(max_length=254, unique=True),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-05 21:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0050_auto_20201002_2156'),
]
operations = [
migrations.AlterField(
model_name='sitesettings',
name='name',
field=models.CharField(default='BookWyrm', max_length=100),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-05 21:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0051_auto_20201005_2142'),
]
operations = [
migrations.AlterField(
model_name='user',
name='email',
field=models.EmailField(blank=True, max_length=254, verbose_name='email address'),
),
]

View file

@ -1,24 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-06 20:20
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0052_auto_20201005_2145'),
]
operations = [
migrations.AddField(
model_name='status',
name='deleted',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='status',
name='deleted_date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
]

View file

@ -1,15 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-14 17:00
from django.contrib.postgres.operations import TrigramExtension
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0052_auto_20201005_2145'),
]
operations = [
TrigramExtension()
]

View file

@ -1,25 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-16 17:07
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0053_auto_20201014_1700'),
]
operations = [
migrations.RemoveField(
model_name='userblocks',
name='relationship_id',
),
migrations.RemoveField(
model_name='userfollowrequest',
name='relationship_id',
),
migrations.RemoveField(
model_name='userfollows',
name='relationship_id',
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-16 23:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0053_auto_20201006_2020'),
]
operations = [
migrations.AlterField(
model_name='status',
name='deleted_date',
field=models.DateTimeField(),
),
]

View file

@ -1,14 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-17 00:11
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0054_auto_20201016_1707'),
('bookwyrm', '0054_auto_20201016_2359'),
]
operations = [
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-21 01:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0055_merge_20201017_0011'),
]
operations = [
migrations.AlterField(
model_name='status',
name='deleted_date',
field=models.DateTimeField(blank=True, null=True),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-26 21:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0056_auto_20201021_0150'),
]
operations = [
migrations.AlterField(
model_name='status',
name='privacy',
field=models.CharField(choices=[('public', 'Public'), ('unlisted', 'Unlisted'), ('followers', 'Followers'), ('direct', 'Direct')], default='public', max_length=255),
),
]

View file

@ -1,17 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-29 23:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0057_auto_20201026_2131'),
]
operations = [
migrations.RemoveField(
model_name='importjob',
name='import_status',
),
]

View file

@ -1,23 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-30 17:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0058_remove_importjob_import_status'),
]
operations = [
migrations.AddField(
model_name='importjob',
name='include_reviews',
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name='importjob',
name='privacy',
field=models.CharField(choices=[('public', 'Public'), ('unlisted', 'Unlisted'), ('followers', 'Followers'), ('direct', 'Direct')], default='public', max_length=255),
),
]

View file

@ -1,19 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-30 20:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0059_auto_20201030_1755'),
]
operations = [
migrations.AlterField(
model_name='user',
name='federated_server',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.FederatedServer'),
),
]

View file

@ -1,17 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-30 21:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0060_auto_20201030_2010'),
]
operations = [
migrations.RenameModel(
old_name='GeneratedStatus',
new_name='GeneratedNote',
),
]

View file

@ -1,38 +0,0 @@
# Generated by Django 3.0.7 on 2020-10-31 19:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0061_auto_20201030_2157'),
]
operations = [
migrations.AlterField(
model_name='connector',
name='api_key',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='connector',
name='max_query_count',
field=models.IntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name='connector',
name='name',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='connector',
name='politeness_delay',
field=models.IntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name='connector',
name='search_url',
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View file

@ -1,26 +0,0 @@
# Generated by Django 3.0.7 on 2020-11-01 17:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0062_auto_20201031_1936'),
]
operations = [
migrations.RemoveConstraint(
model_name='notification',
name='notification_type_valid',
),
migrations.AlterField(
model_name='notification',
name='notification_type',
field=models.CharField(choices=[('FAVORITE', 'Favorite'), ('REPLY', 'Reply'), ('MENTION', 'Mention'), ('TAG', 'Tag'), ('FOLLOW', 'Follow'), ('FOLLOW_REQUEST', 'Follow Request'), ('BOOST', 'Boost'), ('IMPORT', 'Import')], max_length=255),
),
migrations.AddConstraint(
model_name='notification',
constraint=models.CheckConstraint(check=models.Q(notification_type__in=['FAVORITE', 'REPLY', 'MENTION', 'TAG', 'FOLLOW', 'FOLLOW_REQUEST', 'BOOST', 'IMPORT']), name='notification_type_valid'),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.0.7 on 2020-11-01 17:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0062_auto_20201031_1936'),
]
operations = [
migrations.AddField(
model_name='user',
name='last_active_date',
field=models.DateTimeField(auto_now=True),
),
]

View file

@ -1,14 +0,0 @@
# Generated by Django 3.0.7 on 2020-11-01 19:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0063_user_last_active_date'),
('bookwyrm', '0063_auto_20201101_1758'),
]
operations = [
]

View file

@ -68,7 +68,6 @@ class ActivitypubMixin:
if not hasattr(self, mapping.model_key) or not mapping.activity_key:
continue
value = getattr(self, mapping.model_key)
print(value)
if hasattr(value, 'local_id'):
value = value.local_id
elif hasattr(value, 'remote_id'):

View file

@ -139,29 +139,18 @@ class Work(Book):
''' a work (an abstract concept of a book that manifests in an edition) '''
# library of congress catalog control number
lccn = models.CharField(max_length=255, blank=True, null=True)
default_edition = models.ForeignKey('Edition', on_delete=models.PROTECT, null=True)
@property
def editions_path(self):
''' it'd be nice to serialize the edition instead but, recursion '''
return [e.remote_id for e in self.edition_set.all()]
@property
def default_edition(self):
''' best-guess attempt at picking the default edition for this work '''
ed = Edition.objects.filter(parent_work=self, default=True).first()
if not ed:
ed = Edition.objects.filter(parent_work=self).first()
return ed
activity_serializer = activitypub.Work
class Edition(Book):
''' an edition of a book '''
# default -> this is what gets displayed for a work
default = models.BooleanField(default=False)
# these identifiers only apply to editions, not works
isbn_10 = models.CharField(max_length=255, blank=True, null=True)
isbn_13 = models.CharField(max_length=255, blank=True, null=True)

View file

@ -50,5 +50,5 @@ class BookWyrmConnector(TestCase):
def test_get_date(self):
date = get_date(self.edition_data['published_date'])
expected = parser.parse("2017-05-10T00:00:00+00:00")
expected = parser.parse("2020-09-15T00:00:00+00:00")
self.assertEqual(date, expected)

View file

@ -1,42 +1,40 @@
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Document",
"book_type": "Edition",
"name": "Jonathan Strange and Mr Norrell",
"url": "https://example.com/book/122",
"id": "https://bookwyrm.social/book/5989",
"type": "Edition",
"authors": [
"https://example.com/author/25"
"https://bookwyrm.social/author/417"
],
"published_date": "2017-05-10T00:00:00+00:00",
"work": {
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Document",
"book_type": "Work",
"name": "Jonathan Strange and Mr Norrell",
"url": "https://example.com/book/121",
"authors": [
"https://example.com/author/25"
],
"title": "Jonathan Strange and Mr Norrell",
"attachment": [
{
"type": "Document",
"mediaType": "image/jpg",
"url": "https://example.com/images/covers/8775540-M.jpg",
"name": "Cover of \"Jonathan Strange and Mr Norrell\""
}
]
},
"title": "Jonathan Strange and Mr Norrell",
"subtitle": "Bloomsbury Modern Classics",
"isbn_13": "9781408891469",
"physical_format": "paperback",
"first_published_date": null,
"published_date": "2020-09-15T00:00:00+00:00",
"title": "Piranesi",
"sort_title": null,
"subtitle": null,
"description": "Piranesi's house is no ordinary building; its rooms are infinite, its corridors endless, its walls are lined with thousands upon thousands of statues, each one different from all the others. Within the labyrinth of halls an ocean is imprisoned; waves thunder up staircases, rooms are flooded in an instant. But Piranesi is not afraid; he understands the tides as he understands the pattern of the labyrinth itself. He lives to explore the house.\r\n\r\nThere is one other person in the house--a man called The Other, who visits Piranesi twice a week and asks for help with research into A Great and Secret Knowledge. But as Piranesi explores, evidence emerges of another person, and a terrible truth begins to unravel, revealing a world beyond the one Piranesi has always known.\r\n\r\nFor readers of Neil Gaiman's The Ocean at the End of the Lane and fans of Madeline Miller's Circe, Piranesi introduces an astonishing new world, an infinite labyrinth full of startling images of surreal beauty, haunted by the tides and the clouds.",
"languages": [
"English"
],
"series": null,
"series_number": null,
"subjects": [],
"subject_places": [],
"openlibrary_key": "OL29486417M",
"librarything_key": null,
"goodreads_key": null,
"attachment": [
{
"type": "Document",
"mediaType": "image/jpg",
"url": "https://example.com/images/covers/9155821-M.jpg",
"name": "Cover of \"Jonathan Strange and Mr Norrell\""
"url": "https://bookwyrm.social/images/covers/50202953._SX318_.jpg",
"type": "Image"
}
]
],
"isbn_10": "1526622424",
"isbn_13": "9781526622426",
"oclc_number": null,
"asin": null,
"pages": 272,
"physical_format": null,
"publishers": [
"Bloomsbury Publishing Plc"
],
"work": "https://bookwyrm.social/book/5988",
"@context": "https://www.w3.org/ns/activitystreams"
}

View file

@ -1,44 +1,36 @@
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Document",
"book_type": "Work",
"name": "Jonathan Strange and Mr Norrell",
"url": "https://example.com/book/121",
"id": "https://bookwyrm.social/book/5988",
"type": "Work",
"authors": [
"https://example.com/author/25"
"https://bookwyrm.social/author/417"
],
"editions": [
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Document",
"book_type": "Edition",
"name": "Jonathan Strange and Mr Norrell",
"url": "https://example.com/book/122",
"authors": [
"https://example.com/author/25"
],
"published_date": "2017-05-10T00:00:00+00:00",
"title": "Jonathan Strange and Mr Norrell",
"subtitle": "Bloomsbury Modern Classics",
"isbn_13": "9781408891469",
"physical_format": "paperback",
"attachment": [
{
"type": "Document",
"mediaType": "image/jpg",
"url": "https://example.com/images/covers/9155821-M.jpg",
"name": "Cover of \"Jonathan Strange and Mr Norrell\""
}
]
}
"first_published_date": null,
"published_date": null,
"title": "Piranesi",
"sort_title": null,
"subtitle": null,
"description": "**From the *New York Times* bestselling author of *Jonathan Strange & Mr. Norrell*, an intoxicating, hypnotic new novel set in a dreamlike alternative reality.**\r\n\r\nPiranesi's house is no ordinary building; its rooms are infinite, its corridors endless, its walls are lined with thousands upon thousands of statues, each one different from all the others. Within the labyrinth of halls an ocean is imprisoned; waves thunder up staircases, rooms are flooded in an instant. But Piranesi is not afraid; he understands the tides as he understands the pattern of the labyrinth itself. He lives to explore the house.\r\n\r\nThere is one other person in the house--a man called The Other, who visits Piranesi twice a week and asks for help with research into A Great and Secret Knowledge. But as Piranesi explores, evidence emerges of another person, and a terrible truth begins to unravel, revealing a world beyond the one Piranesi has always known.\r\n\r\nFor readers of Neil Gaiman's *The Ocean at the End of the Lane* and fans of Madeline Miller's *Circe*, *Piranesi* introduces an astonishing new world, an infinite labyrinth full of startling images of surreal beauty, haunted by the tides and the clouds.\r\n\r\nThis description comes from the publisher.",
"languages": [],
"series": null,
"series_number": null,
"subjects": [
"English literature"
],
"title": "Jonathan Strange and Mr Norrell",
"subject_places": [],
"openlibrary_key": "OL20893680W",
"librarything_key": null,
"goodreads_key": null,
"attachment": [
{
"type": "Document",
"mediaType": "image/jpg",
"url": "https://example.com/images/covers/8775540-M.jpg",
"name": "Cover of \"Jonathan Strange and Mr Norrell\""
"url": "https://bookwyrm.social/images/covers/10226290-M.jpg",
"type": "Image"
}
]
],
"lccn": null,
"editions": [
"https://bookwyrm.social/book/5989",
"OL28439584M",
"OL28300471M"
],
"@context": "https://www.w3.org/ns/activitystreams"
}

View file

@ -50,7 +50,7 @@ class User(TestCase):
self.assertEqual(activity['inbox'], self.user.inbox)
self.assertEqual(activity['outbox'], self.user.outbox)
self.assertEqual(activity['followers'], self.user.ap_followers)
self.assertEqual(activity['bookwyrmUser'], False)
self.assertEqual(activity['bookwyrmUser'], True)
self.assertEqual(activity['discoverable'], True)
self.assertEqual(activity['type'], 'Person')

View file

@ -10,9 +10,13 @@ class Shelving(TestCase):
local=True,
remote_id='http://local.com/users/mouse',
)
work = models.Work.objects.create(
title='Example work',
)
self.book = models.Edition.objects.create(
title='Example Edition',
remote_id='https://example.com/book/1',
parent_work=work,
)
self.shelf = models.Shelf.objects.create(
name='Test Shelf',
@ -35,7 +39,7 @@ class Shelving(TestCase):
self.assertEqual(shelf.books.get(), self.book)
# it should have posted a status about this
status = models.GeneratedStatus.objects.get()
status = models.GeneratedNote.objects.get()
self.assertEqual(status.content, 'wants to read')
self.assertEqual(status.user, self.user)
self.assertEqual(status.mention_books.count(), 1)
@ -53,7 +57,7 @@ class Shelving(TestCase):
self.assertEqual(shelf.books.get(), self.book)
# it should have posted a status about this
status = models.GeneratedStatus.objects.order_by('-published_date').first()
status = models.GeneratedNote.objects.order_by('-published_date').first()
self.assertEqual(status.content, 'started reading')
self.assertEqual(status.user, self.user)
self.assertEqual(status.mention_books.count(), 1)
@ -75,7 +79,7 @@ class Shelving(TestCase):
self.assertEqual(shelf.books.get(), self.book)
# it should have posted a status about this
status = models.GeneratedStatus.objects.order_by('-published_date').first()
status = models.GeneratedNote.objects.order_by('-published_date').first()
self.assertEqual(status.content, 'finished reading')
self.assertEqual(status.user, self.user)
self.assertEqual(status.mention_books.count(), 1)

View file

@ -61,7 +61,7 @@ class Signature(TestCase):
digest=None,
date=None):
now = date or http_date()
data = json.dumps(get_follow_data(sender, self.rat)).encode('utf-8')
data = json.dumps(get_follow_data(sender, self.rat))
digest = digest or make_digest(data)
signature = make_signature(
signer or sender, self.rat.inbox, now, digest)