mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-02-11 16:45:16 +00:00
Adds privacy setting to shelves
This commit is contained in:
parent
a5a1af418c
commit
ab0f9230c7
2 changed files with 24 additions and 1 deletions
18
bookwyrm/migrations/0009_shelf_privacy.py
Normal file
18
bookwyrm/migrations/0009_shelf_privacy.py
Normal 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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -2,7 +2,7 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from bookwyrm import activitypub
|
from bookwyrm import activitypub
|
||||||
from .base_model import BookWyrmModel, OrderedCollectionMixin
|
from .base_model import BookWyrmModel, OrderedCollectionMixin, PrivacyLevels
|
||||||
|
|
||||||
|
|
||||||
class Shelf(OrderedCollectionMixin, BookWyrmModel):
|
class Shelf(OrderedCollectionMixin, BookWyrmModel):
|
||||||
|
@ -11,6 +11,11 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel):
|
||||||
identifier = models.CharField(max_length=100)
|
identifier = models.CharField(max_length=100)
|
||||||
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
||||||
editable = models.BooleanField(default=True)
|
editable = models.BooleanField(default=True)
|
||||||
|
privacy = models.CharField(
|
||||||
|
max_length=255,
|
||||||
|
default='public',
|
||||||
|
choices=PrivacyLevels.choices
|
||||||
|
)
|
||||||
books = models.ManyToManyField(
|
books = models.ManyToManyField(
|
||||||
'Edition',
|
'Edition',
|
||||||
symmetrical=False,
|
symmetrical=False,
|
||||||
|
|
Loading…
Reference in a new issue