Updates migrations

To get the app working again I ran resetdb, let it crash in initdb,
then ran the migration, then re-ran initdb
This commit is contained in:
Mouse Reeve 2020-09-21 08:10:37 -07:00
parent d1f1260640
commit c7883cd615
106 changed files with 279 additions and 279 deletions

View file

@ -66,13 +66,13 @@ You will need postgres installed and running on your computer.
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
createdb fedireads
createdb bookwyrm
```
Create the psql user in `psql fedireads`:
Create the psql user in `psql bookwyrm`:
``` psql
CREATE ROLE fedireads WITH LOGIN PASSWORD 'fedireads';
GRANT ALL PRIVILEGES ON DATABASE fedireads TO fedireads;
CREATE ROLE bookwyrm WITH LOGIN PASSWORD 'bookwyrm';
GRANT ALL PRIVILEGES ON DATABASE bookwyrm TO bookwyrm;
```
Initialize the database (or, more specifically, delete the existing database, run migrations, and start fresh):

View file

@ -16,7 +16,7 @@ class Person(ActivityObject):
publicKey: PublicKey
endpoints: Dict
icon: Image = field(default=lambda: {})
fedireadsUser: str = False
bookwyrmUser: str = False
manuallyApprovesFollowers: str = False
discoverable: str = True
type: str = 'Person'

View file

@ -4,8 +4,8 @@ from urllib.parse import urlparse
from requests import HTTPError
from fedireads import models
from fedireads.tasks import app
from bookwyrm import models
from bookwyrm.tasks import app
def get_edition(book_id):
@ -43,7 +43,7 @@ def get_or_create_connector(remote_id):
except models.Connector.DoesNotExist:
connector_info = models.Connector.objects.create(
identifier=identifier,
connector_file='fedireads_connector',
connector_file='bookwyrm_connector',
base_url='https://%s' % identifier,
books_url='https://%s/book' % identifier,
covers_url='https://%s/images/covers' % identifier,
@ -115,6 +115,6 @@ def get_connectors():
def load_connector(connector_info):
''' instantiate the connector class '''
connector = importlib.import_module(
'fedireads.connectors.%s' % connector_info.connector_file
'bookwyrm.connectors.%s' % connector_info.connector_file
)
return connector.Connector(connector_info.identifier)

View file

@ -3,10 +3,10 @@ import json
from django.utils.http import http_date
import requests
from fedireads import models
from fedireads.activitypub import ActivityEncoder
from fedireads.tasks import app
from fedireads.signatures import make_signature, make_digest
from bookwyrm import models
from bookwyrm.activitypub import ActivityEncoder
from bookwyrm.tasks import app
from bookwyrm.signatures import make_signature, make_digest
def get_public_recipients(user, software=None):
@ -14,7 +14,7 @@ def get_public_recipients(user, software=None):
followers = user.followers.filter(local=False)
if software:
# TODO: eventually we may want to handle particular software differently
followers = followers.filter(fedireads_user=(software == 'fedireads'))
followers = followers.filter(bookwyrm_user=(software == 'bookwyrm'))
# we want shared inboxes when available
shared = followers.filter(

View file

@ -6,7 +6,7 @@ import requests
from django.db import transaction
from fedireads import models
from bookwyrm import models
class AbstractConnector(ABC):

View file

@ -1,11 +1,11 @@
''' using another fedireads instance as a source of book data '''
''' using another bookwyrm instance as a source of book data '''
from uuid import uuid4
from django.core.exceptions import ObjectDoesNotExist
from django.core.files.base import ContentFile
import requests
from fedireads import models
from bookwyrm import models
from .abstract_connector import AbstractConnector, SearchResult, Mapping
from .abstract_connector import update_from_mappings, get_date, get_data

View file

@ -4,7 +4,7 @@ import requests
from django.core.files.base import ContentFile
from fedireads import models
from bookwyrm import models
from .abstract_connector import AbstractConnector, SearchResult, Mapping
from .abstract_connector import update_from_mappings
from .abstract_connector import get_date, get_data

View file

@ -1,7 +1,7 @@
''' using a fedireads instance as a source of book data '''
''' using a bookwyrm instance as a source of book data '''
from django.contrib.postgres.search import SearchRank, SearchVector
from fedireads import models
from bookwyrm import models
from .abstract_connector import AbstractConnector, SearchResult
@ -12,7 +12,7 @@ class Connector(AbstractConnector):
def search(self, query):
''' right now you can't search fedireads sorry, but when
''' right now you can't search bookwyrm sorry, but when
that gets implemented it will totally rule '''
vector = SearchVector('title', weight='A') +\
SearchVector('subtitle', weight='B') +\

View file

@ -1,3 +1,3 @@
''' settings book data connectors '''
CONNECTORS = ['openlibrary', 'self_connector', 'fedireads_connector']
CONNECTORS = ['openlibrary', 'self_connector', 'bookwyrm_connector']

View file

@ -5,7 +5,7 @@ from django.core.exceptions import ValidationError
from django.forms import ModelForm, PasswordInput, widgets
from django import forms
from fedireads import models
from bookwyrm import models
class LoginForm(ModelForm):

View file

@ -2,10 +2,10 @@
import csv
from requests import HTTPError
from fedireads import outgoing
from fedireads.tasks import app
from fedireads.models import ImportJob, ImportItem
from fedireads.status import create_notification
from bookwyrm import outgoing
from bookwyrm.tasks import app
from bookwyrm.models import ImportJob, ImportItem
from bookwyrm.status import create_notification
# TODO: remove or increase once we're confident it's not causing problems.
MAX_ENTRIES = 500

View file

@ -8,11 +8,11 @@ from django.http import HttpResponseBadRequest, HttpResponseNotFound
from django.views.decorators.csrf import csrf_exempt
import requests
from fedireads import activitypub, books_manager, models, outgoing
from fedireads import status as status_builder
from fedireads.remote_user import get_or_create_remote_user, refresh_remote_user
from fedireads.tasks import app
from fedireads.signatures import Signature
from bookwyrm import activitypub, books_manager, models, outgoing
from bookwyrm import status as status_builder
from bookwyrm.remote_user import get_or_create_remote_user, refresh_remote_user
from bookwyrm.tasks import app
from bookwyrm.signatures import Signature
@csrf_exempt

View file

@ -7,7 +7,7 @@ import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import fedireads.utils.fields
import bookwyrm.utils.fields
class Migration(migrations.Migration):
@ -62,7 +62,7 @@ class Migration(migrations.Migration):
('content', models.TextField(blank=True, null=True)),
('created_date', models.DateTimeField(auto_now_add=True)),
('openlibrary_key', models.CharField(max_length=255)),
('data', fedireads.utils.fields.JSONField()),
('data', bookwyrm.utils.fields.JSONField()),
],
options={
'abstract': False,
@ -75,10 +75,10 @@ class Migration(migrations.Migration):
('content', models.TextField(blank=True, null=True)),
('created_date', models.DateTimeField(auto_now_add=True)),
('openlibrary_key', models.CharField(max_length=255, unique=True)),
('data', fedireads.utils.fields.JSONField()),
('data', bookwyrm.utils.fields.JSONField()),
('cover', models.ImageField(blank=True, null=True, upload_to='covers/')),
('added_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
('authors', models.ManyToManyField(to='fedireads.Author')),
('authors', models.ManyToManyField(to='bookwyrm.Author')),
],
options={
'abstract': False,
@ -120,9 +120,9 @@ class Migration(migrations.Migration):
('local', models.BooleanField(default=True)),
('privacy', models.CharField(default='public', max_length=255)),
('sensitive', models.BooleanField(default=False)),
('mention_books', models.ManyToManyField(related_name='mention_book', to='fedireads.Book')),
('mention_books', models.ManyToManyField(related_name='mention_book', to='bookwyrm.Book')),
('mention_users', models.ManyToManyField(related_name='mention_user', to=settings.AUTH_USER_MODEL)),
('reply_parent', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='fedireads.Status')),
('reply_parent', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Status')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
],
options={
@ -151,8 +151,8 @@ class Migration(migrations.Migration):
('content', models.TextField(blank=True, null=True)),
('created_date', models.DateTimeField(auto_now_add=True)),
('added_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fedireads.Book')),
('shelf', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fedireads.Shelf')),
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Book')),
('shelf', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Shelf')),
],
options={
'unique_together': {('book', 'shelf')},
@ -161,7 +161,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='shelf',
name='books',
field=models.ManyToManyField(through='fedireads.ShelfBook', to='fedireads.Book'),
field=models.ManyToManyField(through='bookwyrm.ShelfBook', to='bookwyrm.Book'),
),
migrations.AddField(
model_name='shelf',
@ -171,17 +171,17 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='book',
name='shelves',
field=models.ManyToManyField(through='fedireads.ShelfBook', to='fedireads.Shelf'),
field=models.ManyToManyField(through='bookwyrm.ShelfBook', to='bookwyrm.Shelf'),
),
migrations.AddField(
model_name='user',
name='federated_server',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='fedireads.FederatedServer'),
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.FederatedServer'),
),
migrations.AddField(
model_name='user',
name='followers',
field=models.ManyToManyField(through='fedireads.UserRelationship', to=settings.AUTH_USER_MODEL),
field=models.ManyToManyField(through='bookwyrm.UserRelationship', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='user',
@ -200,14 +200,14 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Review',
fields=[
('status_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='fedireads.Status')),
('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)),
('rating', models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(5)])),
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fedireads.Book')),
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Book')),
],
options={
'abstract': False,
},
bases=('fedireads.status',),
bases=('bookwyrm.status',),
),
]

View file

@ -8,7 +8,7 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0001_initial'),
('bookwyrm', '0001_initial'),
]
operations = [
@ -18,7 +18,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('content', models.TextField(blank=True, null=True)),
('created_date', models.DateTimeField(auto_now_add=True)),
('status', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fedireads.Status')),
('status', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Status')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
],
options={
@ -28,11 +28,11 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='status',
name='favorites',
field=models.ManyToManyField(related_name='user_favorites', through='fedireads.Favorite', to=settings.AUTH_USER_MODEL),
field=models.ManyToManyField(related_name='user_favorites', through='bookwyrm.Favorite', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='user',
name='favorites',
field=models.ManyToManyField(related_name='favorite_statuses', through='fedireads.Favorite', to='fedireads.Status'),
field=models.ManyToManyField(related_name='favorite_statuses', through='bookwyrm.Favorite', to='bookwyrm.Status'),
),
]

View file

@ -7,7 +7,7 @@ import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0002_auto_20200219_0816'),
('bookwyrm', '0002_auto_20200219_0816'),
]
operations = [

View file

@ -8,7 +8,7 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0003_auto_20200221_0131'),
('bookwyrm', '0003_auto_20200221_0131'),
]
operations = [
@ -19,7 +19,7 @@ class Migration(migrations.Migration):
('created_date', models.DateTimeField(auto_now_add=True)),
('updated_date', models.DateTimeField(auto_now=True)),
('name', models.CharField(max_length=140)),
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fedireads.Book')),
('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={

View file

@ -5,7 +5,7 @@ from django.db import migrations, models
def populate_identifiers(app_registry, schema_editor):
db_alias = schema_editor.connection.alias
tags = app_registry.get_model('fedireads', 'Tag')
tags = app_registry.get_model('bookwyrm', 'Tag')
for tag in tags.objects.using(db_alias):
tag.identifier = re.sub(r'\W+', '-', tag.name).lower()
tag.save()
@ -14,7 +14,7 @@ def populate_identifiers(app_registry, schema_editor):
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0004_tag'),
('bookwyrm', '0004_tag'),
]
operations = [

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0005_auto_20200221_1645'),
('bookwyrm', '0005_auto_20200221_1645'),
]
operations = [

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0006_auto_20200221_1702'),
('bookwyrm', '0006_auto_20200221_1702'),
]
operations = [

View file

@ -7,13 +7,13 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0007_auto_20200223_0902'),
('bookwyrm', '0007_auto_20200223_0902'),
]
operations = [
migrations.AlterField(
model_name='user',
name='followers',
field=models.ManyToManyField(related_name='following', through='fedireads.UserRelationship', to=settings.AUTH_USER_MODEL),
field=models.ManyToManyField(related_name='following', through='bookwyrm.UserRelationship', to=settings.AUTH_USER_MODEL),
),
]

View file

@ -7,7 +7,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0008_auto_20200224_1504'),
('bookwyrm', '0008_auto_20200224_1504'),
]
operations = [

View file

@ -3,21 +3,21 @@
import datetime
from django.db import migrations, models
import django.db.models.deletion
import fedireads.utils.fields
import bookwyrm.utils.fields
import uuid
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0009_status_published_date'),
('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='fedireads.Book')),
('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)),
@ -25,18 +25,18 @@ class Migration(migrations.Migration):
options={
'abstract': False,
},
bases=('fedireads.book',),
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='fedireads.Book')),
('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=('fedireads.book',),
bases=('bookwyrm.book',),
),
migrations.RemoveField(
model_name='author',
@ -53,7 +53,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='author',
name='aliases',
field=fedireads.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, size=None),
field=bookwyrm.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, size=None),
),
migrations.AddField(
model_name='author',
@ -129,7 +129,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='book',
name='misc_identifiers',
field=fedireads.utils.fields.JSONField(null=True),
field=bookwyrm.utils.fields.JSONField(null=True),
),
migrations.AddField(
model_name='book',
@ -185,6 +185,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='book',
name='parent_work',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='fedireads.Work'),
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Work'),
),
]

View file

@ -8,7 +8,7 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0010_auto_20200307_0655'),
('bookwyrm', '0010_auto_20200307_0655'),
]
operations = [
@ -20,8 +20,8 @@ class Migration(migrations.Migration):
('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='fedireads.Book')),
('related_status', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='fedireads.Status')),
('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)),
],

View file

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

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0012_auto_20200308_1625'),
('bookwyrm', '0012_auto_20200308_1625'),
]
operations = [

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0013_user_manually_approves_followers'),
('bookwyrm', '0013_user_manually_approves_followers'),
]
operations = [

View file

@ -8,7 +8,7 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0014_status_remote_id'),
('bookwyrm', '0014_status_remote_id'),
]
operations = [
@ -88,17 +88,17 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='user',
name='blocks',
field=models.ManyToManyField(related_name='blocked_by', through='fedireads.UserBlocks', to=settings.AUTH_USER_MODEL),
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='fedireads.UserFollowRequest', to=settings.AUTH_USER_MODEL),
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='fedireads.UserFollows', to=settings.AUTH_USER_MODEL),
field=models.ManyToManyField(related_name='followers', through='bookwyrm.UserFollows', to=settings.AUTH_USER_MODEL),
),
migrations.AddConstraint(
model_name='userfollows',

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0015_auto_20200311_1212'),
('bookwyrm', '0015_auto_20200311_1212'),
]
operations = [

View file

@ -7,7 +7,7 @@ import django.db.models.expressions
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0016_auto_20200313_1337'),
('bookwyrm', '0016_auto_20200313_1337'),
]
operations = [

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0017_auto_20200314_2152'),
('bookwyrm', '0017_auto_20200314_2152'),
]
operations = [

View file

@ -7,20 +7,20 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0018_favorite_remote_id'),
('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='fedireads.Status')),
('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='fedireads.Book')),
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Book')),
],
options={
'abstract': False,
},
bases=('fedireads.status',),
bases=('bookwyrm.status',),
),
]

View file

@ -2,13 +2,13 @@
from django.db import migrations, models
import django.db.models.deletion
import fedireads.models.book
import bookwyrm.models.book
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0019_comment'),
('bookwyrm', '0019_comment'),
]
operations = [
@ -19,7 +19,7 @@ class Migration(migrations.Migration):
('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'), ('fedireads', 'Fedireads')], default='openlibrary', max_length=255)),
('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)),
@ -48,11 +48,11 @@ class Migration(migrations.Migration):
),
migrations.AddConstraint(
model_name='connector',
constraint=models.CheckConstraint(check=models.Q(connector_file__in=fedireads.models.connector.ConnectorFiles), name='connector_file_valid'),
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='fedireads.Connector'),
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Connector'),
),
]

View file

@ -1,13 +1,13 @@
# Generated by Django 3.0.3 on 2020-03-28 04:28
from django.db import migrations, models
import fedireads.utils.fields
import bookwyrm.utils.fields
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0020_auto_20200327_2335'),
('bookwyrm', '0020_auto_20200327_2335'),
]
operations = [
@ -19,12 +19,12 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='book',
name='subject_places',
field=fedireads.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None),
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=fedireads.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None),
field=bookwyrm.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None),
),
migrations.AddField(
model_name='edition',
@ -34,7 +34,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='edition',
name='publishers',
field=fedireads.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None),
field=bookwyrm.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None),
),
migrations.AlterField(
model_name='connector',

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0021_auto_20200328_0428'),
('bookwyrm', '0021_auto_20200328_0428'),
]
operations = [

View file

@ -7,7 +7,7 @@ import uuid
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0022_auto_20200328_2001'),
('bookwyrm', '0022_auto_20200328_2001'),
]
operations = [

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0023_auto_20200328_2203'),
('bookwyrm', '0023_auto_20200328_2203'),
]
operations = [

View file

@ -7,7 +7,7 @@ import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0024_federatedserver_application_version'),
('bookwyrm', '0024_federatedserver_application_version'),
]
operations = [

View file

@ -7,19 +7,19 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0025_auto_20200330_0037'),
('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='fedireads.Status')),
('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=('fedireads.status',),
bases=('bookwyrm.status',),
),
migrations.RemoveConstraint(
model_name='notification',
@ -37,6 +37,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='boost',
name='boosted_status',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='boosters', to='fedireads.Status'),
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='boosters', to='bookwyrm.Status'),
),
]

View file

@ -2,13 +2,13 @@
from django.db import migrations, models
import django.db.models.deletion
import fedireads.utils.fields
import bookwyrm.utils.fields
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0026_auto_20200330_1456'),
('bookwyrm', '0026_auto_20200330_1456'),
]
operations = [
@ -27,7 +27,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='book',
name='languages',
field=fedireads.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None),
field=bookwyrm.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None),
),
migrations.AddField(
model_name='edition',
@ -37,46 +37,46 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='edition',
name='parent_work',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='fedireads.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='fedireads.ShelfBook', to='fedireads.Shelf'),
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='fedireads.Edition'),
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='fedireads.Edition'),
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='fedireads.Edition'),
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Edition'),
),
migrations.AlterField(
model_name='shelf',
name='books',
field=models.ManyToManyField(through='fedireads.ShelfBook', to='fedireads.Edition'),
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='fedireads.Edition'),
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='fedireads.Edition'),
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='fedireads.Edition'),
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Edition'),
),
]

View file

@ -7,7 +7,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0027_auto_20200330_2232'),
('bookwyrm', '0027_auto_20200330_2232'),
]
operations = [

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0028_auto_20200401_1824'),
('bookwyrm', '0028_auto_20200401_1824'),
]
operations = [

View file

@ -7,20 +7,20 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0029_auto_20200403_1835'),
('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='fedireads.Status')),
('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='fedireads.Edition')),
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Edition')),
],
options={
'abstract': False,
},
bases=('fedireads.status',),
bases=('bookwyrm.status',),
),
]

View file

@ -8,7 +8,7 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0030_quotation'),
('bookwyrm', '0030_quotation'),
]
operations = [
@ -21,7 +21,7 @@ class Migration(migrations.Migration):
('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='fedireads.Book')),
('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={

View file

@ -4,13 +4,13 @@ from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import fedireads.utils.fields
import bookwyrm.utils.fields
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0031_readthrough'),
('bookwyrm', '0031_readthrough'),
]
operations = [
@ -18,7 +18,7 @@ class Migration(migrations.Migration):
name='ImportItem',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('data', fedireads.utils.fields.JSONField()),
('data', bookwyrm.utils.fields.JSONField()),
],
),
migrations.CreateModel(
@ -50,11 +50,11 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='importitem',
name='book',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='fedireads.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='fedireads.ImportJob'),
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='bookwyrm.ImportJob'),
),
]

View file

@ -7,7 +7,7 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0032_auto_20200421_1347'),
('bookwyrm', '0032_auto_20200421_1347'),
]
operations = [
@ -29,7 +29,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='notification',
name='related_import',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='fedireads.ImportJob'),
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.ImportJob'),
),
migrations.AlterField(
model_name='notification',

View file

@ -7,13 +7,13 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0033_auto_20200422_1249'),
('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='fedireads.Status'),
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Status'),
),
]

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0034_importjob_import_status'),
('bookwyrm', '0034_importjob_import_status'),
]
operations = [

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0035_auto_20200429_1708'),
('bookwyrm', '0035_auto_20200429_1708'),
]
operations = [

View file

@ -7,7 +7,7 @@ import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0036_auto_20200503_2007'),
('bookwyrm', '0036_auto_20200503_2007'),
]
operations = [

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0037_auto_20200504_0154'),
('bookwyrm', '0037_auto_20200504_0154'),
]
operations = [

View file

@ -6,7 +6,7 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0038_author_remote_id'),
('bookwyrm', '0038_author_remote_id'),
]
operations = [

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0039_auto_20200510_2342'),
('bookwyrm', '0039_auto_20200510_2342'),
]
operations = [

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0040_auto_20200513_0153'),
('bookwyrm', '0040_auto_20200513_0153'),
]
operations = [

View file

@ -6,7 +6,7 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0041_user_remote_id'),
('bookwyrm', '0041_user_remote_id'),
]
operations = [

View file

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0041_user_remote_id'),
('bookwyrm', '0041_user_remote_id'),
]
operations = [

View file

@ -1,13 +1,13 @@
# Generated by Django 3.0.3 on 2020-06-01 21:31
from django.db import migrations, models
import fedireads.models.site
import bookwyrm.models.site
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0042_sitesettings'),
('bookwyrm', '0042_sitesettings'),
]
operations = [
@ -15,7 +15,7 @@ class Migration(migrations.Migration):
name='SiteInvite',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(default=fedireads.models.site.new_invite_code, max_length=32)),
('code', models.CharField(default=bookwyrm.models.site.new_invite_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

@ -8,7 +8,7 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0043_siteinvite'),
('bookwyrm', '0043_siteinvite'),
]
operations = [

View file

@ -6,8 +6,8 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0044_siteinvite_user'),
('fedireads', '0042_auto_20200524_0346'),
('bookwyrm', '0044_siteinvite_user'),
('bookwyrm', '0042_auto_20200524_0346'),
]
operations = [

View file

@ -11,8 +11,8 @@ from Crypto.Hash import SHA256
from django.db import models
from django.dispatch import receiver
from fedireads import activitypub
from fedireads.settings import DOMAIN
from bookwyrm import activitypub
from bookwyrm.settings import DOMAIN
class FedireadsModel(models.Model):
''' shared fields '''

View file

@ -4,9 +4,9 @@ from django.utils import timezone
from django.utils.http import http_date
from model_utils.managers import InheritanceManager
from fedireads import activitypub
from fedireads.settings import DOMAIN
from fedireads.utils.fields import ArrayField
from bookwyrm import activitypub
from bookwyrm.settings import DOMAIN
from bookwyrm.utils.fields import ArrayField
from .base_model import ActivityMapping, ActivitypubMixin, FedireadsModel

View file

@ -1,6 +1,6 @@
''' manages interfaces with external sources of book data '''
from django.db import models
from fedireads.connectors.settings import CONNECTORS
from bookwyrm.connectors.settings import CONNECTORS
from .base_model import FedireadsModel

View file

@ -8,7 +8,7 @@ class FederatedServer(FedireadsModel):
server_name = models.CharField(max_length=255, unique=True)
# federated, blocked, whatever else
status = models.CharField(max_length=255, default='federated')
# is it mastodon, fedireads, etc
# is it mastodon, bookwyrm, etc
application_type = models.CharField(max_length=255, null=True)
application_version = models.CharField(max_length=255, null=True)

View file

@ -5,11 +5,11 @@ import dateutil.parser
from django.db import models
from django.utils import timezone
from fedireads import books_manager
from fedireads.models import ReadThrough, User, Book
from fedireads.utils.fields import JSONField
from bookwyrm import books_manager
from bookwyrm.models import ReadThrough, User, Book
from bookwyrm.utils.fields import JSONField
# Mapping goodreads -> fedireads shelf titles.
# Mapping goodreads -> bookwyrm shelf titles.
GOODREADS_SHELVES = {
'read': 'read',
'currently-reading': 'reading',

View file

@ -1,7 +1,7 @@
''' defines relationships between users '''
from django.db import models
from fedireads import activitypub
from bookwyrm import activitypub
from .base_model import FedireadsModel

View file

@ -1,7 +1,7 @@
''' puttin' books on shelves '''
from django.db import models
from fedireads import activitypub
from bookwyrm import activitypub
from .base_model import FedireadsModel, OrderedCollectionMixin

View file

@ -5,7 +5,7 @@ from django.db import models
from django.utils import timezone
import datetime
from fedireads.settings import DOMAIN
from bookwyrm.settings import DOMAIN
from .user import User
class SiteSettings(models.Model):

View file

@ -5,7 +5,7 @@ from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from model_utils.managers import InheritanceManager
from fedireads import activitypub
from bookwyrm import activitypub
from .base_model import ActivitypubMixin, OrderedCollectionPageMixin
from .base_model import ActivityMapping, FedireadsModel
@ -67,7 +67,7 @@ class Status(OrderedCollectionPageMixin, FedireadsModel):
ActivityMapping('replies', 'ap_replies'),
]
# serializing to fedireads expanded activitypub
# serializing to bookwyrm expanded activitypub
activity_mappings = shared_mappings + [
ActivityMapping('name', 'name'),
ActivityMapping('inReplyToBook', 'book'),

View file

@ -3,8 +3,8 @@ import urllib.parse
from django.db import models
from fedireads import activitypub
from fedireads.settings import DOMAIN
from bookwyrm import activitypub
from bookwyrm.settings import DOMAIN
from .base_model import OrderedCollectionMixin, FedireadsModel

View file

@ -5,11 +5,11 @@ from django.contrib.auth.models import AbstractUser
from django.db import models
from django.dispatch import receiver
from fedireads import activitypub
from fedireads.models.shelf import Shelf
from fedireads.models.status import Status
from fedireads.settings import DOMAIN
from fedireads.signatures import create_key_pair
from bookwyrm import activitypub
from bookwyrm.models.shelf import Shelf
from bookwyrm.models.status import Status
from bookwyrm.settings import DOMAIN
from bookwyrm.signatures import create_key_pair
from .base_model import OrderedCollectionPageMixin
from .base_model import ActivityMapping
@ -28,7 +28,7 @@ class User(OrderedCollectionPageMixin, AbstractUser):
outbox = models.CharField(max_length=255, unique=True)
summary = models.TextField(blank=True, null=True)
local = models.BooleanField(default=True)
fedireads_user = models.BooleanField(default=True)
bookwyrm_user = models.BooleanField(default=True)
localname = models.CharField(
max_length=255,
null=True,

View file

@ -6,13 +6,13 @@ from django.http import HttpResponseNotFound, JsonResponse
from django.views.decorators.csrf import csrf_exempt
import requests
from fedireads import activitypub
from fedireads import models
from fedireads.broadcast import broadcast
from fedireads.status import create_review, create_status
from fedireads.status import create_quotation, create_comment
from fedireads.status import create_tag, create_notification, create_rating
from fedireads.remote_user import get_or_create_remote_user
from bookwyrm import activitypub
from bookwyrm import models
from bookwyrm.broadcast import broadcast
from bookwyrm.status import create_review, create_status
from bookwyrm.status import create_quotation, create_comment
from bookwyrm.status import create_tag, create_notification, create_rating
from bookwyrm.remote_user import get_or_create_remote_user
@csrf_exempt
@ -227,9 +227,9 @@ def handle_status(user, book_id, builder, *args):
book = models.Edition.objects.get(id=book_id)
status = builder(user, book, *args)
broadcast(user, status.to_create_activity(user), software='fedireads')
broadcast(user, status.to_create_activity(user), software='bookwyrm')
# re-format the activity for non-fedireads servers
# re-format the activity for non-bookwyrm servers
remote_activity = status.to_create_activity(user, pure=True)
broadcast(user, remote_activity, software='other')

View file

@ -6,7 +6,7 @@ import requests
from django.core.files.base import ContentFile
from django.db import transaction
from fedireads import activitypub, models
from bookwyrm import activitypub, models
def get_or_create_remote_user(actor):
@ -28,7 +28,7 @@ def get_or_create_remote_user(actor):
if avatar:
user.avatar.save(*avatar)
if user.fedireads_user:
if user.bookwyrm_user:
get_remote_reviews(user)
return user
@ -79,7 +79,7 @@ def get_avatar(data):
def get_remote_reviews(user):
''' ingest reviews by a new remote fedireads user '''
''' ingest reviews by a new remote bookwyrm user '''
outbox_page = user.outbox + '?page=true'
response = requests.get(
outbox_page,
@ -88,7 +88,7 @@ def get_remote_reviews(user):
data = response.json()
# TODO: pagination?
for status in data['orderedItems']:
if status.get('fedireadsType') == 'Review':
if status.get('bookwyrmType') == 'Review':
activitypub.Review(**status).to_model(models.Review)

View file

@ -1,8 +1,8 @@
''' Routine tasks for keeping your library tidy '''
from datetime import timedelta
from django.utils import timezone
from fedireads import books_manager
from fedireads import models
from bookwyrm import books_manager
from bookwyrm import models
def sync_book_data():
''' update books with any changes to their canonical source '''

View file

@ -1,4 +1,4 @@
''' fedireads settings and configuration '''
''' bookwyrm settings and configuration '''
import os
from environs import Env
@ -31,14 +31,14 @@ OL_URL = env('OL_URL')
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
#'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'fedireads',
'bookwyrm',
'celery',
]
@ -52,7 +52,7 @@ MIDDLEWARE = [
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'fedireads.urls'
ROOT_URLCONF = 'bookwyrm.urls'
TEMPLATES = [
{
@ -71,7 +71,7 @@ TEMPLATES = [
]
WSGI_APPLICATION = 'fedireads.wsgi.application'
WSGI_APPLICATION = 'bookwyrm.wsgi.application'
# Database
@ -100,7 +100,7 @@ DATABASES = {
LOGIN_URL = '/login/'
AUTH_USER_MODEL = 'fedireads.User'
AUTH_USER_MODEL = 'bookwyrm.User'
# Password validation
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators

View file

@ -1,9 +1,9 @@
''' Handle user activity '''
from django.db import IntegrityError
from fedireads import models
from fedireads.books_manager import get_or_create_book
from fedireads.sanitize_html import InputHtmlParser
from bookwyrm import models
from bookwyrm.books_manager import get_or_create_book
from bookwyrm.sanitize_html import InputHtmlParser
def create_rating(user, book, rating):

View file

@ -2,10 +2,10 @@
import os
from celery import Celery
from fedireads import settings
from bookwyrm import settings
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fr_celery.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'celerywyrm.settings')
app = Celery(
'tasks',
broker=settings.CELERY_BROKER,

View file

@ -1,7 +1,7 @@
''' template filters '''
from django import template
from fedireads import models
from bookwyrm import models
register = template.Library()

View file

@ -1,7 +1,7 @@
import datetime
from django.test import TestCase
from fedireads import models
from bookwyrm import models
class Author(TestCase):

View file

@ -2,7 +2,7 @@ import json
import pathlib
from django.test import TestCase
from fedireads import activitypub, models
from bookwyrm import activitypub, models
class Person(TestCase):

View file

@ -2,7 +2,7 @@ import json
import pathlib
from django.test import TestCase
from fedireads import activitypub, models
from bookwyrm import activitypub, models
class Quotation(TestCase):

View file

@ -1,10 +1,10 @@
''' testing book data connectors '''
from django.test import TestCase
from fedireads import models
from fedireads.connectors.abstract_connector import Mapping,\
from bookwyrm import models
from bookwyrm.connectors.abstract_connector import Mapping,\
update_from_mappings
from fedireads.connectors.fedireads_connector import Connector
from bookwyrm.connectors.bookwyrm_connector import Connector
class FedireadsConnector(TestCase):
@ -13,7 +13,7 @@ class FedireadsConnector(TestCase):
models.Connector.objects.create(
identifier='example.com',
connector_file='fedireads_connector',
connector_file='bookwyrm_connector',
base_url='https://example.com',
books_url='https:/example.com',
covers_url='https://example.com',

View file

@ -4,16 +4,16 @@ from django.test import TestCase
import json
import pathlib
from fedireads import models
from fedireads.connectors.fedireads_connector import Connector
from fedireads.connectors.abstract_connector import SearchResult, get_date
from bookwyrm import models
from bookwyrm.connectors.bookwyrm_connector import Connector
from bookwyrm.connectors.abstract_connector import SearchResult, get_date
class FedireadsConnector(TestCase):
def setUp(self):
models.Connector.objects.create(
identifier='example.com',
connector_file='fedireads_connector',
connector_file='bookwyrm_connector',
base_url='https://example.com',
books_url='https://example.com',
covers_url='https://example.com/images/covers',

View file

@ -5,11 +5,11 @@ import json
import pathlib
import pytz
from fedireads import models
from fedireads.connectors.openlibrary import Connector
from fedireads.connectors.openlibrary import get_languages, get_description
from fedireads.connectors.openlibrary import pick_default_edition, get_openlibrary_key
from fedireads.connectors.abstract_connector import SearchResult, get_date
from bookwyrm import models
from bookwyrm.connectors.openlibrary import Connector
from bookwyrm.connectors.openlibrary import get_languages, get_description
from bookwyrm.connectors.openlibrary import pick_default_edition, get_openlibrary_key
from bookwyrm.connectors.abstract_connector import SearchResult, get_date
class Openlibrary(TestCase):

View file

@ -2,9 +2,9 @@
import datetime
from django.test import TestCase
from fedireads import models
from fedireads.connectors.self_connector import Connector
from fedireads.settings import DOMAIN
from bookwyrm import models
from bookwyrm.connectors.self_connector import Connector
from bookwyrm.settings import DOMAIN
class SelfConnector(TestCase):

View file

@ -26,7 +26,7 @@
"endpoints": {
"sharedInbox": "https://example.com/inbox"
},
"fedireadsUser": true,
"bookwyrmUser": true,
"manuallyApprovesFollowers": false,
"icon": {
"type": "Image",

View file

@ -1,9 +1,9 @@
''' testing models '''
from django.test import TestCase
from fedireads import models
from fedireads.models.base_model import FedireadsModel
from fedireads.settings import DOMAIN
from bookwyrm import models
from bookwyrm.models.base_model import FedireadsModel
from bookwyrm.settings import DOMAIN
class BaseModel(TestCase):
@ -11,7 +11,7 @@ class BaseModel(TestCase):
instance = FedireadsModel()
instance.id = 1
expected = instance.get_remote_id()
self.assertEqual(expected, 'https://%s/fedireadsmodel/1' % DOMAIN)
self.assertEqual(expected, 'https://%s/bookwyrmmodel/1' % DOMAIN)
def test_remote_id_with_user(self):
user = models.User.objects.create_user(
@ -22,4 +22,4 @@ class BaseModel(TestCase):
expected = instance.get_remote_id()
self.assertEqual(
expected,
'https://%s/user/mouse/fedireadsmodel/1' % DOMAIN)
'https://%s/user/mouse/bookwyrmmodel/1' % DOMAIN)

View file

@ -1,7 +1,7 @@
''' testing models '''
from django.test import TestCase
from fedireads import models, settings
from bookwyrm import models, settings
class Book(TestCase):

View file

@ -2,7 +2,7 @@
import datetime
from django.test import TestCase
from fedireads import models
from bookwyrm import models
class ImportJob(TestCase):

View file

@ -1,7 +1,7 @@
''' testing models '''
from django.test import TestCase
from fedireads import models, settings
from bookwyrm import models, settings
class Status(TestCase):

View file

@ -1,8 +1,8 @@
''' testing models '''
from django.test import TestCase
from fedireads import models
from fedireads.settings import DOMAIN
from bookwyrm import models
from bookwyrm.settings import DOMAIN
class User(TestCase):

View file

@ -1,7 +1,7 @@
from django.test import TestCase
from fedireads import models
from fedireads import status as status_builder
from bookwyrm import models
from bookwyrm import status as status_builder
class Comment(TestCase):

View file

@ -2,8 +2,8 @@ from django.test import TestCase
import json
import pathlib
from fedireads import activitypub, models
from fedireads import status as status_builder
from bookwyrm import activitypub, models
from bookwyrm import status as status_builder
class Quotation(TestCase):

View file

@ -1,7 +1,7 @@
from django.test import TestCase
from fedireads import models
from fedireads import status as status_builder
from bookwyrm import models
from bookwyrm import status as status_builder
class Review(TestCase):

View file

@ -1,7 +1,7 @@
from django.test import TestCase
from fedireads import models
from fedireads import status as status_builder
from bookwyrm import models
from bookwyrm import status as status_builder
class Status(TestCase):

View file

@ -1,8 +1,8 @@
from django.test import TestCase
from fedireads import books_manager, models
from fedireads.connectors.fedireads_connector import Connector
from fedireads.settings import DOMAIN
from bookwyrm import books_manager, models
from bookwyrm.connectors.bookwyrm_connector import Connector
from bookwyrm.settings import DOMAIN
class Book(TestCase):

View file

@ -1,7 +1,7 @@
from django.test import TestCase
from fedireads import models, broadcast
from fedireads.settings import DOMAIN
from bookwyrm import models, broadcast
from bookwyrm.settings import DOMAIN
class Book(TestCase):
@ -31,7 +31,7 @@ class Book(TestCase):
outbox='http://example2.com/u/3/o',
inbox='http://example2.com/u/3/inbox',
shared_inbox='http://example2.com/inbox',
fedireads_user=False, local=False)
bookwyrm_user=False, local=False)
self.user.followers.add(non_fr_follower)
local_follower = models.User.objects.create_user(
@ -64,7 +64,7 @@ class Book(TestCase):
'http://example.com/u/2/inbox',
]
recipients = broadcast.get_public_recipients(self.user, software='fedireads')
recipients = broadcast.get_public_recipients(self.user, software='bookwyrm')
self.assertEqual(recipients, expected)

View file

@ -2,7 +2,7 @@ import json
import pathlib
from django.test import TestCase
from fedireads import models, incoming
from bookwyrm import models, incoming
class Favorite(TestCase):

View file

@ -2,7 +2,7 @@ import json
import pathlib
from django.test import TestCase
from fedireads import models, remote_user
from bookwyrm import models, remote_user
class RemoteUser(TestCase):
@ -42,7 +42,7 @@ class RemoteUser(TestCase):
self.user_data['publicKey']['publicKeyPem']
)
self.assertEqual(user.local, False)
self.assertEqual(user.fedireads_user, True)
self.assertEqual(user.bookwyrm_user, True)
self.assertEqual(user.manually_approves_followers, False)

View file

@ -1,6 +1,6 @@
from django.test import TestCase
from fedireads.sanitize_html import InputHtmlParser
from bookwyrm.sanitize_html import InputHtmlParser
class Sanitizer(TestCase):

View file

@ -9,10 +9,10 @@ import responses
from django.test import TestCase, Client
from django.utils.http import http_date
from fedireads.models import User
from fedireads.activitypub import Follow
from fedireads.settings import DOMAIN
from fedireads.signatures import create_key_pair, make_signature, make_digest
from bookwyrm.models import User
from bookwyrm.activitypub import Follow
from bookwyrm.settings import DOMAIN
from bookwyrm.signatures import create_key_pair, make_signature, make_digest
def get_follow_data(follower, followee):
follow_activity = Follow(

View file

@ -1,10 +1,10 @@
''' url routing for the app and api '''
from django.conf.urls.static import static
from django.contrib import admin
#from django.contrib import admin
from django.urls import path, re_path
from fedireads import incoming, outgoing, views, settings, wellknown
from fedireads import view_actions as actions
from bookwyrm import incoming, outgoing, views, settings, wellknown
from bookwyrm import view_actions as actions
username_regex = r'(?P<username>[\w\-_]+@[\w\-\_\.]+)'
localname_regex = r'(?P<username>[\w\-_]+)'
@ -17,10 +17,10 @@ status_path = r'%s/(%s)/(?P<status_id>\d+)' % \
book_path = r'^book/(?P<book_id>\d+)'
handler404 = 'fedireads.views.not_found_page'
handler500 = 'fedireads.views.server_error_page'
handler404 = 'bookwyrm.views.not_found_page'
handler500 = 'bookwyrm.views.server_error_page'
urlpatterns = [
path('admin/', admin.site.urls),
# path('admin/', admin.site.urls),
# federation endpoints
re_path(r'^inbox/?$', incoming.shared_inbox),

Some files were not shown because too many files have changed in this diff Show more