diff --git a/bookwyrm/templates/shelf.html b/bookwyrm/templates/shelf.html
index f8e0e35b..571578cf 100644
--- a/bookwyrm/templates/shelf.html
+++ b/bookwyrm/templates/shelf.html
@@ -31,18 +31,21 @@
{% if is_self %}
{% if is_self %}
{% include 'snippets/shelf.html' with shelf=shelf ratings=ratings %}
diff --git a/bookwyrm/templates/snippets/privacy_select.html b/bookwyrm/templates/snippets/privacy_select.html
index 83ea9bea..c8d974c0 100644
--- a/bookwyrm/templates/snippets/privacy_select.html
+++ b/bookwyrm/templates/snippets/privacy_select.html
@@ -5,10 +5,18 @@
{% endif %}
{% endwith %}
diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py
index 82726c66..d55c6f61 100644
--- a/bookwyrm/urls.py
+++ b/bookwyrm/urls.py
@@ -121,6 +121,7 @@ urlpatterns = [
re_path(r'^delete-status/?$', actions.delete_status),
re_path(r'^create-shelf/?$', actions.create_shelf),
+ re_path(r'^edit-shelf/(?P
\d+)?$', actions.edit_shelf),
re_path(r'^shelve/?$', actions.shelve),
re_path(r'^unshelve/?$', actions.unshelve),
re_path(r'^start-reading/?$', actions.start_reading),
diff --git a/bookwyrm/view_actions.py b/bookwyrm/view_actions.py
index ee035c5c..518aa271 100644
--- a/bookwyrm/view_actions.py
+++ b/bookwyrm/view_actions.py
@@ -11,7 +11,7 @@ from django.contrib.auth.decorators import login_required, permission_required
from django.core.exceptions import PermissionDenied
from django.core.files.base import ContentFile
from django.http import HttpResponseBadRequest, HttpResponseNotFound
-from django.shortcuts import redirect
+from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.utils import timezone
@@ -276,6 +276,20 @@ def upload_cover(request, book_id):
def create_shelf(request):
''' user generated shelves '''
form = forms.ShelfForm(request.POST)
+ if not form.is_valid():
+ return redirect(request.headers.get('Referer', '/'))
+
+ shelf = form.save()
+ return redirect('/user/%s/shelf/%s' % \
+ (request.user.localname, shelf.identifier))
+
+
+@login_required
+def edit_shelf(request, shelf_id):
+ ''' user generated shelves '''
+ shelf = get_object_or_404(models.Shelf, id=shelf_id)
+
+ form = forms.ShelfForm(request.POST, instance=shelf)
if not form.is_valid():
return redirect(request.headers.get('Referer', '/'))
shelf = form.save()