def form_valid(self, form): self.comment_obj.comment = form.cleaned_data.get("comment") self.comment_obj.save(update_fields=["comment"]) comment_id = self.comment_obj.id current_site = get_current_site(self.request) send_email_user_mentions.delay(comment_id, 'leads', domain=current_site.domain, protocol=self.request.scheme) return JsonResponse({ "commentid": self.comment_obj.id, "comment": self.comment_obj.comment, })
def form_valid(self, form): comment = form.save(commit=False) comment.commented_by = self.request.user comment.lead = self.lead comment.save() comment_id = comment.id current_site = get_current_site(self.request) send_email_user_mentions.delay(comment_id, 'leads', domain=current_site.domain, protocol=self.request.scheme) return JsonResponse({ "comment_id": comment.id, "comment": comment.comment, "commented_on": comment.commented_on, "commented_on_arrow": comment.commented_on_arrow, "commented_by": comment.commented_by.email })