X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/f9a071b288cec64a55000125a63b62a3b233c3fd..a3b153ea6e30da275edf3e34b8d2f8ca1bb436cc:/src/social/views.py?ds=sidebyside diff --git a/src/social/views.py b/src/social/views.py index d9627eb9e..9087d7bba 100644 --- a/src/social/views.py +++ b/src/social/views.py @@ -8,8 +8,6 @@ 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 @@ -68,12 +66,15 @@ 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/2022/my_shelf.html' + tags = list(request.user.tag_set.all()) + suggest = [t for t in tags if t.name] + print(suggest) + return render(request, template_name, { - 'books': Book.tagged.with_any(request.user.tag_set.all()) + 'tags': tags, + 'books': Book.tagged.with_any(tags), + 'suggest': suggest, }) @@ -124,20 +125,3 @@ def my_tags(request): t.name for t in tags ], safe=False ) - - -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), {}