Adds privacy setting to shelves

This commit is contained in:
Mouse Reeve 2020-11-10 13:39:58 -08:00
parent a5a1af418c
commit ab0f9230c7
2 changed files with 24 additions and 1 deletions

View file

@ -0,0 +1,18 @@
# Generated by Django 3.0.7 on 2020-11-10 20:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0008_work_default_edition'),
]
operations = [
migrations.AddField(
model_name='shelf',
name='privacy',
field=models.CharField(choices=[('public', 'Public'), ('unlisted', 'Unlisted'), ('followers', 'Followers'), ('direct', 'Direct')], default='public', max_length=255),
),
]

View file

@ -2,7 +2,7 @@
from django.db import models
from bookwyrm import activitypub
from .base_model import BookWyrmModel, OrderedCollectionMixin
from .base_model import BookWyrmModel, OrderedCollectionMixin, PrivacyLevels
class Shelf(OrderedCollectionMixin, BookWyrmModel):
@ -11,6 +11,11 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel):
identifier = models.CharField(max_length=100)
user = models.ForeignKey('User', on_delete=models.PROTECT)
editable = models.BooleanField(default=True)
privacy = models.CharField(
max_length=255,
default='public',
choices=PrivacyLevels.choices
)
books = models.ManyToManyField(
'Edition',
symmetrical=False,