def reply(request, cid): try: comment = XtdComment.objects.get(pk=cid) if not comment.allow_thread(): raise MaxThreadLevelExceededException(comment) except MaxThreadLevelExceededException as exc: return HttpResponseForbidden(exc) except XtdComment.DoesNotExist as exc: raise Http404(exc) form = get_form()(comment.content_object, comment=comment) next = request.GET.get("next", reverse("comments-xtd-sent")) template_arg = [ "django_comments_xtd/%s/%s/reply.html" % (comment.content_type.app_label, comment.content_type.model), "django_comments_xtd/%s/reply.html" % (comment.content_type.app_label, ), "django_comments_xtd/reply.html" ] return render(request, template_arg, { "comment": comment, "form": form, "cid": cid, "next": next })
def reply(request, cid): try: comment = XtdComment.objects.get(pk=cid) if not comment.allow_thread(): raise MaxThreadLevelExceededException(comment) except MaxThreadLevelExceededException as exc: return HttpResponseForbidden(exc) except XtdComment.DoesNotExist as exc: raise Http404(exc) ct_str = "%s.%s" % (comment.content_type.app_label, comment.content_type.model) options = get_app_model_options(content_type=ct_str) if (not request.user.is_authenticated and options['who_can_post'] == 'users'): path = request.build_absolute_uri() resolved_login_url = resolve_url(settings.LOGIN_URL) return redirect_to_login(path, resolved_login_url, REDIRECT_FIELD_NAME) form = get_form()(comment.content_object, comment=comment) next = request.GET.get("next", reverse("comments-xtd-sent")) template_arg = [ "django_comments_xtd/%s/%s/reply.html" % (comment.content_type.app_label, comment.content_type.model), "django_comments_xtd/%s/reply.html" % (comment.content_type.app_label, ), "django_comments_xtd/reply.html" ] return render(request, template_arg, { "comment": comment, "form": form, "cid": cid, "next": next })
def reply(request, cid, app_slug): try: comment = XtdComment.objects.get(pk=cid) if not comment.allow_thread(): raise MaxThreadLevelExceededException(comment) except MaxThreadLevelExceededException as exc: return HttpResponseForbidden(exc) except XtdComment.DoesNotExist as exc: raise Http404(exc) form = XtdCommentForm(comment.content_object, comment=comment) template_arg = [ "mobile/reply.html", ] return render(request, template_arg, { "comment": comment, "form": form, "cid": cid, 'app_slug': app_slug })