def comments(request: HttpRequest): """ Отзывы """ Visit.make(request, '/comments') if request.method == 'POST' and request.is_ajax(): form = CommentForm(request.POST) if form.is_valid(): response_data = Comment.make(request, form) return JsonResponse(response_data) return render( request, 'comments.html', { 'name': 'comments', 'title': 'Отзывы', 'form': CommentForm, 'last': Comment.last_order, 'comments': list( zip(Comment.next_tuples(), Comment.comment_tuples())), 'year': datetime.now().year, })