forked from mirrors/bookwyrm
Renames bookwyrm base model
This commit is contained in:
parent
c7883cd615
commit
3aa9c3accf
8 changed files with 20 additions and 20 deletions
|
@ -14,7 +14,7 @@ from django.dispatch import receiver
|
||||||
from bookwyrm import activitypub
|
from bookwyrm import activitypub
|
||||||
from bookwyrm.settings import DOMAIN
|
from bookwyrm.settings import DOMAIN
|
||||||
|
|
||||||
class FedireadsModel(models.Model):
|
class BookWyrmModel(models.Model):
|
||||||
''' shared fields '''
|
''' shared fields '''
|
||||||
created_date = models.DateTimeField(auto_now_add=True)
|
created_date = models.DateTimeField(auto_now_add=True)
|
||||||
updated_date = models.DateTimeField(auto_now=True)
|
updated_date = models.DateTimeField(auto_now=True)
|
||||||
|
|
|
@ -8,10 +8,10 @@ from bookwyrm import activitypub
|
||||||
from bookwyrm.settings import DOMAIN
|
from bookwyrm.settings import DOMAIN
|
||||||
from bookwyrm.utils.fields import ArrayField
|
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 '''
|
''' a generic book, which can mean either an edition or a work '''
|
||||||
# these identifiers apply to both works and editions
|
# these identifiers apply to both works and editions
|
||||||
openlibrary_key = models.CharField(max_length=255, blank=True, null=True)
|
openlibrary_key = models.CharField(max_length=255, blank=True, null=True)
|
||||||
|
@ -175,7 +175,7 @@ class Edition(Book):
|
||||||
activity_serializer = activitypub.Edition
|
activity_serializer = activitypub.Edition
|
||||||
|
|
||||||
|
|
||||||
class Author(ActivitypubMixin, FedireadsModel):
|
class Author(ActivitypubMixin, BookWyrmModel):
|
||||||
''' copy of an author from OL '''
|
''' copy of an author from OL '''
|
||||||
openlibrary_key = models.CharField(max_length=255, blank=True, null=True)
|
openlibrary_key = models.CharField(max_length=255, blank=True, null=True)
|
||||||
sync = models.BooleanField(default=True)
|
sync = models.BooleanField(default=True)
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from bookwyrm.connectors.settings import CONNECTORS
|
from bookwyrm.connectors.settings import CONNECTORS
|
||||||
|
|
||||||
from .base_model import FedireadsModel
|
from .base_model import BookWyrmModel
|
||||||
|
|
||||||
|
|
||||||
ConnectorFiles = models.TextChoices('ConnectorFiles', CONNECTORS)
|
ConnectorFiles = models.TextChoices('ConnectorFiles', CONNECTORS)
|
||||||
class Connector(FedireadsModel):
|
class Connector(BookWyrmModel):
|
||||||
''' book data source connectors '''
|
''' book data source connectors '''
|
||||||
identifier = models.CharField(max_length=255, unique=True)
|
identifier = models.CharField(max_length=255, unique=True)
|
||||||
priority = models.IntegerField(default=2)
|
priority = models.IntegerField(default=2)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
''' connections to external ActivityPub servers '''
|
''' connections to external ActivityPub servers '''
|
||||||
from django.db import models
|
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 '''
|
''' store which server's we federate with '''
|
||||||
server_name = models.CharField(max_length=255, unique=True)
|
server_name = models.CharField(max_length=255, unique=True)
|
||||||
# federated, blocked, whatever else
|
# federated, blocked, whatever else
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from bookwyrm import activitypub
|
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 '''
|
''' many-to-many through table for followers '''
|
||||||
user_subject = models.ForeignKey(
|
user_subject = models.ForeignKey(
|
||||||
'User',
|
'User',
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from bookwyrm import activitypub
|
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 '''
|
''' a list of books owned by a user '''
|
||||||
name = models.CharField(max_length=100)
|
name = models.CharField(max_length=100)
|
||||||
identifier = models.CharField(max_length=100)
|
identifier = models.CharField(max_length=100)
|
||||||
|
@ -33,7 +33,7 @@ class Shelf(OrderedCollectionMixin, FedireadsModel):
|
||||||
unique_together = ('user', 'identifier')
|
unique_together = ('user', 'identifier')
|
||||||
|
|
||||||
|
|
||||||
class ShelfBook(FedireadsModel):
|
class ShelfBook(BookWyrmModel):
|
||||||
''' many to many join table for books and shelves '''
|
''' many to many join table for books and shelves '''
|
||||||
book = models.ForeignKey('Edition', on_delete=models.PROTECT)
|
book = models.ForeignKey('Edition', on_delete=models.PROTECT)
|
||||||
shelf = models.ForeignKey('Shelf', on_delete=models.PROTECT)
|
shelf = models.ForeignKey('Shelf', on_delete=models.PROTECT)
|
||||||
|
|
|
@ -7,10 +7,10 @@ from model_utils.managers import InheritanceManager
|
||||||
|
|
||||||
from bookwyrm import activitypub
|
from bookwyrm import activitypub
|
||||||
from .base_model import ActivitypubMixin, OrderedCollectionPageMixin
|
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 '''
|
''' any post, like a reply to a review, etc '''
|
||||||
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
||||||
content = models.TextField(blank=True, null=True)
|
content = models.TextField(blank=True, null=True)
|
||||||
|
@ -161,7 +161,7 @@ class Review(Status):
|
||||||
activity_serializer = activitypub.Review
|
activity_serializer = activitypub.Review
|
||||||
|
|
||||||
|
|
||||||
class Favorite(ActivitypubMixin, FedireadsModel):
|
class Favorite(ActivitypubMixin, BookWyrmModel):
|
||||||
''' fav'ing a post '''
|
''' fav'ing a post '''
|
||||||
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
||||||
status = models.ForeignKey('Status', on_delete=models.PROTECT)
|
status = models.ForeignKey('Status', on_delete=models.PROTECT)
|
||||||
|
@ -201,7 +201,7 @@ class Boost(Status):
|
||||||
# unique_together = ('user', 'boosted_status')
|
# unique_together = ('user', 'boosted_status')
|
||||||
|
|
||||||
|
|
||||||
class ReadThrough(FedireadsModel):
|
class ReadThrough(BookWyrmModel):
|
||||||
''' Store progress through a book in the database. '''
|
''' Store progress through a book in the database. '''
|
||||||
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
||||||
book = models.ForeignKey('Book', on_delete=models.PROTECT)
|
book = models.ForeignKey('Book', on_delete=models.PROTECT)
|
||||||
|
@ -220,7 +220,7 @@ NotificationType = models.TextChoices(
|
||||||
'NotificationType',
|
'NotificationType',
|
||||||
'FAVORITE REPLY TAG FOLLOW FOLLOW_REQUEST BOOST IMPORT')
|
'FAVORITE REPLY TAG FOLLOW FOLLOW_REQUEST BOOST IMPORT')
|
||||||
|
|
||||||
class Notification(FedireadsModel):
|
class Notification(BookWyrmModel):
|
||||||
''' you've been tagged, liked, followed, etc '''
|
''' you've been tagged, liked, followed, etc '''
|
||||||
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
||||||
related_book = models.ForeignKey(
|
related_book = models.ForeignKey(
|
||||||
|
|
|
@ -5,10 +5,10 @@ from django.db import models
|
||||||
|
|
||||||
from bookwyrm import activitypub
|
from bookwyrm import activitypub
|
||||||
from bookwyrm.settings import DOMAIN
|
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 '''
|
''' freeform tags for books '''
|
||||||
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
||||||
book = models.ForeignKey('Edition', on_delete=models.PROTECT)
|
book = models.ForeignKey('Edition', on_delete=models.PROTECT)
|
||||||
|
|
Loading…
Reference in a new issue