update group and list models

- remove GroupList model
- add a group foreign key value  to List model
- remove reference to lists in Group model
This commit is contained in:
Hugh Rundle 2021-09-26 15:50:15 +10:00
parent ec0720514e
commit 686198472d
3 changed files with 8 additions and 15 deletions

View file

@ -21,7 +21,7 @@ from .relationship import UserFollows, UserFollowRequest, UserBlocks
from .report import Report, ReportComment
from .federated_server import FederatedServer
from .group import Group, GroupList, GroupMember
from .group import Group, GroupMember
from .import_job import ImportJob, ImportItem

View file

@ -16,14 +16,6 @@ class Group(BookWyrmModel):
"User", on_delete=models.PROTECT)
description = fields.TextField(blank=True, null=True)
privacy = fields.PrivacyField()
lists = models.ManyToManyField(
"List",
symmetrical=False,
through="GroupList",
through_fields=("group", "book_list"),
)
members = models.ManyToManyField(
"User",
symmetrical=False,
@ -32,12 +24,6 @@ class Group(BookWyrmModel):
related_name="members"
)
class GroupList(BookWyrmModel):
"""Lists that group members can edit"""
group = models.ForeignKey("Group", on_delete=models.CASCADE)
book_list = models.ForeignKey("List", on_delete=models.CASCADE)
class GroupMember(models.Model):
"""Users who are members of a group"""

View file

@ -1,4 +1,5 @@
""" make a list of books!! """
from dataclasses import field
from django.apps import apps
from django.db import models
from django.utils import timezone
@ -16,6 +17,7 @@ CurationType = models.TextChoices(
"closed",
"open",
"curated",
"group"
],
)
@ -32,6 +34,11 @@ class List(OrderedCollectionMixin, BookWyrmModel):
curation = fields.CharField(
max_length=255, default="closed", choices=CurationType.choices
)
group = models.ForeignKey(
"Group",
on_delete=models.CASCADE,
null=True
)
books = models.ManyToManyField(
"Edition",
symmetrical=False,