Renames bookwyrm base model

This commit is contained in:
Mouse Reeve 2020-09-21 08:16:34 -07:00
parent c7883cd615
commit 3aa9c3accf
8 changed files with 20 additions and 20 deletions

View file

@ -14,7 +14,7 @@ from django.dispatch import receiver
from bookwyrm import activitypub
from bookwyrm.settings import DOMAIN
class FedireadsModel(models.Model):
class BookWyrmModel(models.Model):
''' shared fields '''
created_date = models.DateTimeField(auto_now_add=True)
updated_date = models.DateTimeField(auto_now=True)

View file

@ -8,10 +8,10 @@ from bookwyrm import activitypub
from bookwyrm.settings import DOMAIN
from bookwyrm.utils.fields import ArrayField
from .base_model import ActivityMapping, ActivitypubMixin, FedireadsModel
from .base_model import ActivityMapping, ActivitypubMixin, BookWyrmModel
class Book(ActivitypubMixin, FedireadsModel):
class Book(ActivitypubMixin, BookWyrmModel):
''' a generic book, which can mean either an edition or a work '''
# these identifiers apply to both works and editions
openlibrary_key = models.CharField(max_length=255, blank=True, null=True)
@ -175,7 +175,7 @@ class Edition(Book):
activity_serializer = activitypub.Edition
class Author(ActivitypubMixin, FedireadsModel):
class Author(ActivitypubMixin, BookWyrmModel):
''' copy of an author from OL '''
openlibrary_key = models.CharField(max_length=255, blank=True, null=True)
sync = models.BooleanField(default=True)

View file

@ -2,11 +2,11 @@
from django.db import models
from bookwyrm.connectors.settings import CONNECTORS
from .base_model import FedireadsModel
from .base_model import BookWyrmModel
ConnectorFiles = models.TextChoices('ConnectorFiles', CONNECTORS)
class Connector(FedireadsModel):
class Connector(BookWyrmModel):
''' book data source connectors '''
identifier = models.CharField(max_length=255, unique=True)
priority = models.IntegerField(default=2)

View file

@ -1,9 +1,9 @@
''' connections to external ActivityPub servers '''
from django.db import models
from .base_model import FedireadsModel
from .base_model import BookWyrmModel
class FederatedServer(FedireadsModel):
class FederatedServer(BookWyrmModel):
''' store which server's we federate with '''
server_name = models.CharField(max_length=255, unique=True)
# federated, blocked, whatever else

View file

@ -2,10 +2,10 @@
from django.db import models
from bookwyrm import activitypub
from .base_model import FedireadsModel
from .base_model import BookWyrmModel
class UserRelationship(FedireadsModel):
class UserRelationship(BookWyrmModel):
''' many-to-many through table for followers '''
user_subject = models.ForeignKey(
'User',

View file

@ -2,10 +2,10 @@
from django.db import models
from bookwyrm import activitypub
from .base_model import FedireadsModel, OrderedCollectionMixin
from .base_model import BookWyrmModel, OrderedCollectionMixin
class Shelf(OrderedCollectionMixin, FedireadsModel):
class Shelf(OrderedCollectionMixin, BookWyrmModel):
''' a list of books owned by a user '''
name = models.CharField(max_length=100)
identifier = models.CharField(max_length=100)
@ -33,7 +33,7 @@ class Shelf(OrderedCollectionMixin, FedireadsModel):
unique_together = ('user', 'identifier')
class ShelfBook(FedireadsModel):
class ShelfBook(BookWyrmModel):
''' many to many join table for books and shelves '''
book = models.ForeignKey('Edition', on_delete=models.PROTECT)
shelf = models.ForeignKey('Shelf', on_delete=models.PROTECT)

View file

@ -7,10 +7,10 @@ from model_utils.managers import InheritanceManager
from bookwyrm import activitypub
from .base_model import ActivitypubMixin, OrderedCollectionPageMixin
from .base_model import ActivityMapping, FedireadsModel
from .base_model import ActivityMapping, BookWyrmModel
class Status(OrderedCollectionPageMixin, FedireadsModel):
class Status(OrderedCollectionPageMixin, BookWyrmModel):
''' any post, like a reply to a review, etc '''
user = models.ForeignKey('User', on_delete=models.PROTECT)
content = models.TextField(blank=True, null=True)
@ -161,7 +161,7 @@ class Review(Status):
activity_serializer = activitypub.Review
class Favorite(ActivitypubMixin, FedireadsModel):
class Favorite(ActivitypubMixin, BookWyrmModel):
''' fav'ing a post '''
user = models.ForeignKey('User', on_delete=models.PROTECT)
status = models.ForeignKey('Status', on_delete=models.PROTECT)
@ -201,7 +201,7 @@ class Boost(Status):
# unique_together = ('user', 'boosted_status')
class ReadThrough(FedireadsModel):
class ReadThrough(BookWyrmModel):
''' Store progress through a book in the database. '''
user = models.ForeignKey('User', on_delete=models.PROTECT)
book = models.ForeignKey('Book', on_delete=models.PROTECT)
@ -220,7 +220,7 @@ NotificationType = models.TextChoices(
'NotificationType',
'FAVORITE REPLY TAG FOLLOW FOLLOW_REQUEST BOOST IMPORT')
class Notification(FedireadsModel):
class Notification(BookWyrmModel):
''' you've been tagged, liked, followed, etc '''
user = models.ForeignKey('User', on_delete=models.PROTECT)
related_book = models.ForeignKey(

View file

@ -5,10 +5,10 @@ from django.db import models
from bookwyrm import activitypub
from bookwyrm.settings import DOMAIN
from .base_model import OrderedCollectionMixin, FedireadsModel
from .base_model import OrderedCollectionMixin, BookWyrmModel
class Tag(OrderedCollectionMixin, FedireadsModel):
class Tag(OrderedCollectionMixin, BookWyrmModel):
''' freeform tags for books '''
user = models.ForeignKey('User', on_delete=models.PROTECT)
book = models.ForeignKey('Edition', on_delete=models.PROTECT)