Groups profile settings templates
This commit is contained in:
parent
24af288c52
commit
9fa8ee3940
12 changed files with 41 additions and 32 deletions
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue