diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html index ddbafbb4..a696e287 100644 --- a/bookwyrm/templates/layout.html +++ b/bookwyrm/templates/layout.html @@ -81,7 +81,7 @@
[A-Za-z0-9]+)/?$',
views.PasswordReset.as_view()),
- re_path(r'^change-password/?$', views.ChangePassword.as_view()),
# invites
re_path(r'^invite/?$', views.ManageInvites.as_view()),
@@ -76,9 +74,15 @@ urlpatterns = [
re_path(r'%s/shelves/?$' % user_path, views.user_shelves_page),
re_path(r'%s/followers(.json)?/?$' % user_path, views.Followers.as_view()),
re_path(r'%s/following(.json)?/?$' % user_path, views.Following.as_view()),
- re_path(r'^edit-profile/?$', views.EditUser.as_view()),
re_path(r'%s/rss' % user_path, views.rss_feed.RssFeed()),
+ # preferences
+ re_path(r'^preferences/profile/?$', views.EditUser.as_view()),
+ re_path(r'^preferences/password/?$', views.ChangePassword.as_view()),
+ re_path(r'^preferences/block/?$', views.Block.as_view()),
+ re_path(r'^block/(?P\d+)/?$', views.Block.as_view()),
+ re_path(r'^unblock/(?P\d+)/?$', views.unblock),
+
# reading goals
re_path(r'%s/goal/(?P\d{4})/?$' % user_path, views.Goal.as_view()),
@@ -140,7 +144,4 @@ urlpatterns = [
re_path(r'^accept-follow-request/?$', views.accept_follow_request),
re_path(r'^delete-follow-request/?$', views.delete_follow_request),
- re_path(r'^block/?$', views.Block.as_view()),
- re_path(r'^block/(?P\d+)/?$', views.Block.as_view()),
- re_path(r'^unblock/(?P\d+)/?$', views.unblock),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
diff --git a/bookwyrm/views/__init__.py b/bookwyrm/views/__init__.py
index e3ac29c8..36a4bed9 100644
--- a/bookwyrm/views/__init__.py
+++ b/bookwyrm/views/__init__.py
@@ -17,6 +17,7 @@ from .notifications import Notifications
from .outbox import Outbox
from .reading import edit_readthrough, create_readthrough, delete_readthrough
from .reading import start_reading, finish_reading, delete_progressupdate
+from .rss_feed import RssFeed
from .password import PasswordResetRequest, PasswordReset, ChangePassword
from .tag import Tag, AddTag, RemoveTag
from .search import Search
diff --git a/bookwyrm/views/block.py b/bookwyrm/views/block.py
index fb95479a..ebcced2a 100644
--- a/bookwyrm/views/block.py
+++ b/bookwyrm/views/block.py
@@ -17,7 +17,7 @@ class Block(View):
def get(self, request):
''' list of blocked users? '''
return TemplateResponse(
- request, 'blocks.html', {'title': 'Blocked Users'})
+ request, 'preferences/blocks.html', {'title': 'Blocked Users'})
def post(self, request, user_id):
''' block a user '''
@@ -31,7 +31,7 @@ class Block(View):
privacy='direct',
direct_recipients=[to_block]
)
- return redirect('/block')
+ return redirect('/preferences/block')
@require_POST
@@ -55,4 +55,4 @@ def unblock(request, user_id):
direct_recipients=[to_unblock]
)
block.delete()
- return redirect('/block')
+ return redirect('/preferences/block')
diff --git a/bookwyrm/views/password.py b/bookwyrm/views/password.py
index 06ddc1da..2adeebf5 100644
--- a/bookwyrm/views/password.py
+++ b/bookwyrm/views/password.py
@@ -94,7 +94,8 @@ class ChangePassword(View):
'title': 'Change Password',
'user': request.user,
}
- return TemplateResponse(request, 'change_password.html', data)
+ return TemplateResponse(
+ request, 'preferences/change_password.html', data)
def post(self, request):
''' allow a user to change their password '''
@@ -102,9 +103,9 @@ class ChangePassword(View):
confirm_password = request.POST.get('confirm-password')
if new_password != confirm_password:
- return redirect('/edit-profile')
+ return redirect('preferences/password')
request.user.set_password(new_password)
request.user.save()
login(request, request.user)
- return redirect('/user/%s' % request.user.localname)
+ return redirect(request.user.local_path)
diff --git a/bookwyrm/views/rss_feed.py b/bookwyrm/views/rss_feed.py
index d6bcd174..496689ff 100644
--- a/bookwyrm/views/rss_feed.py
+++ b/bookwyrm/views/rss_feed.py
@@ -1,29 +1,35 @@
-''' '''
+''' serialize user's posts in rss feed '''
from django.contrib.syndication.views import Feed
-from django.urls import reverse
-from bookwyrm.models.user import User
from .helpers import get_activity_feed, get_user_from_username
+# pylint: disable=no-self-use, unused-argument
class RssFeed(Feed):
-
- description_template = "snippets/rss_content.html"
- title_template = "snippets/rss_title.html"
+ ''' serialize user's posts in rss feed '''
+ description_template = 'snippets/rss_content.html'
+ title_template = 'snippets/rss_title.html'
def get_object(self, request, username):
+ ''' the user who's posts get serialized '''
return get_user_from_username(username)
+
def link(self, obj):
+ ''' link to the user's profile '''
return obj.local_path
+
def title(self, obj):
- return f"Status updates from {obj.display_name}"
+ ''' title of the rss feed entry '''
+ return f'Status updates from {obj.display_name}'
def items(self, obj):
- return get_activity_feed(obj, ['public', 'unlisted'], queryset=obj.status_set)
+ ''' the user's activity feed '''
+ return get_activity_feed(
+ obj, ['public', 'unlisted'], queryset=obj.status_set)
+
-
def item_link(self, item):
+ ''' link to the status '''
return item.local_path
-
diff --git a/bookwyrm/views/user.py b/bookwyrm/views/user.py
index 4bbd8e29..a06face2 100644
--- a/bookwyrm/views/user.py
+++ b/bookwyrm/views/user.py
@@ -153,7 +153,7 @@ class EditUser(View):
'form': forms.EditUserForm(instance=request.user),
'user': request.user,
}
- return TemplateResponse(request, 'settings/edit_user.html', data)
+ return TemplateResponse(request, 'preferences/edit_user.html', data)
def post(self, request):
''' les get fancy with images '''
@@ -161,7 +161,7 @@ class EditUser(View):
request.POST, request.FILES, instance=request.user)
if not form.is_valid():
data = {'form': form, 'user': request.user}
- return TemplateResponse(request, 'settings/edit_user.html', data)
+ return TemplateResponse(request, 'preferences/edit_user.html', data)
user = form.save(commit=False)