diff --git a/bookwyrm/models/shelf.py b/bookwyrm/models/shelf.py
index 739c0599a..3209da5d9 100644
--- a/bookwyrm/models/shelf.py
+++ b/bookwyrm/models/shelf.py
@@ -37,9 +37,13 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel):
""" set the identifier """
super().save(*args, **kwargs)
if not self.identifier:
- slug = re.sub(r"[^\w]", "", self.name).lower()
- self.identifier = "%s-%d" % (slug, self.id)
- super().save(*args, **kwargs)
+ self.identifier = self.get_identifier()
+ super().save(*args, **kwargs, broadcast=False)
+
+ def get_identifier(self):
+ """ custom-shelf-123 for the url """
+ slug = re.sub(r"[^\w]", "", self.name).lower()
+ return "{:s}-{:d}".format(slug, self.id)
@property
def collection_queryset(self):
@@ -49,7 +53,8 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel):
def get_remote_id(self):
""" shelf identifier instead of id """
base_path = self.user.remote_id
- return "%s/shelf/%s" % (base_path, self.identifier)
+ identifier = self.identifier or self.get_identifier()
+ return "%s/books/%s" % (base_path, identifier)
class Meta:
""" user/shelf unqiueness """
diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html
index 95cf86ada..3931ea5bf 100644
--- a/bookwyrm/templates/book/book.html
+++ b/bookwyrm/templates/book/book.html
@@ -165,32 +165,11 @@
{% include 'snippets/readthrough.html' with readthrough=readthrough %}
{% endfor %}
- {% endif %}
- {% if request.user.is_authenticated %}
{% trans "This shelf is empty." %}
- {% if shelf.editable %} + {% if shelf.id and shelf.editable %}