X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/83559fba0846ad77721b31231d1d807a91e52157..77effa3964014b07dbdf73a9e67eb0b20749d50b:/catalogue/views.py?ds=inline diff --git a/catalogue/views.py b/catalogue/views.py index 8feb63c22..de41e1518 100644 --- a/catalogue/views.py +++ b/catalogue/views.py @@ -165,19 +165,21 @@ def login(request): return HttpResponse(LazyEncoder(ensure_ascii=False).encode(response_data)) -@login_required def book_sets(request, slug): book = get_object_or_404(models.Book, slug=slug) user_sets = models.Tag.objects.filter(category='set', user=request.user) book_sets = book.tags.filter(category='set', user=request.user) + if not request.user.is_authenticated(): + return HttpResponse('

Aby zarządzać swoimi półkami, musisz się zalogować.

') + if request.method == 'POST': form = forms.BookSetsForm(book, request.user, request.POST) if form.is_valid(): book.tags = ([models.Tag.objects.get(pk=id) for id in form.cleaned_data['set_ids']] + list(book.tags.filter(~Q(category='set') | ~Q(user=request.user)))) if request.is_ajax(): - return HttpResponse('

Zestawy zostały zapisane

') + return HttpResponse('

Półki zostały zapisane

') else: return HttpResponseRedirect('/') else: