X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/b0fadf2591f3af957c1c8e0307d0bcef9e9f8538..adc204acad4f4e8eacf67faa0ca9b3d916cd3c91:/src/social/views.py?ds=inline diff --git a/src/social/views.py b/src/social/views.py index cff7c8e6a..3dfcd9e2b 100644 --- a/src/social/views.py +++ b/src/social/views.py @@ -1,5 +1,5 @@ -# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Wolne Lektury. See NOTICE for more information. # from django.shortcuts import render, get_object_or_404, redirect from django.http import HttpResponseForbidden, JsonResponse @@ -8,11 +8,9 @@ from django.views.decorators.cache import never_cache from django.views.decorators.http import require_POST from django.views.generic.edit import FormView -from ajaxable.utils import AjaxableFormView - from catalogue.models import Book, Tag import catalogue.models.tag -from social import forms +from social import forms, models from wolnelektury.utils import is_ajax @@ -68,11 +66,7 @@ def unlike_book(request, slug): @login_required def my_shelf(request): - if request.EXPERIMENTS['layout'].value: - template_name = 'social/2022/my_shelf.html' - else: - template_name = 'social/my_shelf.html' - + template_name = 'social/my_shelf.html' tags = list(request.user.tag_set.all()) suggest = [t for t in tags if t.name] print(suggest) @@ -133,18 +127,10 @@ def my_tags(request): ) -class ObjectSetsFormView(AjaxableFormView): - form_class = forms.ObjectSetsForm - placeholdize = True - template = 'social/sets_form.html' - ajax_redirect = True - POST_login = True - - def get_object(self, request, slug): - return get_object_or_404(Book, slug=slug) - - def context_description(self, request, obj): - return obj.pretty_title() - - def form_args(self, request, obj): - return (obj, request.user), {} +def confirm_user(request, key): + uc = get_object_or_404(models.UserConfirmation, key=key) + user = uc.user + uc.use() + return render(request, 'social/user_confirmation.html', { + 'user': user, + })