diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py
index dbe3cb887..29c6b6de7 100644
--- a/bookwyrm/forms.py
+++ b/bookwyrm/forms.py
@@ -159,3 +159,8 @@ class CreateInviteForm(CustomForm):
choices=[(i, "%d uses" % (i,)) for i in [1, 5, 10, 25, 50, 100]]
+ [(None, 'Unlimited')])
}
+
+class ShelfForm(CustomForm):
+ class Meta:
+ model = models.Shelf
+ fields = ['user', 'name', 'privacy']
diff --git a/bookwyrm/migrations/0009_shelf_privacy.py b/bookwyrm/migrations/0009_shelf_privacy.py
new file mode 100644
index 000000000..8232c2edc
--- /dev/null
+++ b/bookwyrm/migrations/0009_shelf_privacy.py
@@ -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),
+ ),
+ ]
diff --git a/bookwyrm/models/shelf.py b/bookwyrm/models/shelf.py
index cd82198c9..e85294bab 100644
--- a/bookwyrm/models/shelf.py
+++ b/bookwyrm/models/shelf.py
@@ -1,8 +1,9 @@
''' puttin' books on shelves '''
+import re
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 +12,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,
@@ -18,6 +24,15 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel):
through_fields=('shelf', 'book')
)
+ def save(self, *args, **kwargs):
+ ''' set the identifier '''
+ saved = super().save(*args, **kwargs)
+ if not self.identifier:
+ slug = re.sub(r'[^\w]', '', self.name).lower()
+ self.identifier = '%s-%d' % (slug, self.id)
+ return super().save(*args, **kwargs)
+ return saved
+
@property
def collection_queryset(self):
''' list of books for this shelf, overrides OrderedCollectionMixin '''
diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py
index 6b162f9f2..46bc25142 100644
--- a/bookwyrm/settings.py
+++ b/bookwyrm/settings.py
@@ -6,6 +6,8 @@ from environs import Env
env = Env()
DOMAIN = env('DOMAIN')
+PAGE_LENGTH = env('PAGE_LENGTH', 15)
+
# celery
CELERY_BROKER = env('CELERY_BROKER')
CELERY_RESULT_BACKEND = env('CELERY_RESULT_BACKEND')
diff --git a/bookwyrm/static/css/fonts/icomoon.eot b/bookwyrm/static/css/fonts/icomoon.eot
index 0c2680e2a..30ae2cd57 100644
Binary files a/bookwyrm/static/css/fonts/icomoon.eot and b/bookwyrm/static/css/fonts/icomoon.eot differ
diff --git a/bookwyrm/static/css/fonts/icomoon.svg b/bookwyrm/static/css/fonts/icomoon.svg
index 4edc79130..aa0a9e5d4 100644
--- a/bookwyrm/static/css/fonts/icomoon.svg
+++ b/bookwyrm/static/css/fonts/icomoon.svg
@@ -37,4 +37,5 @@