def modify_comment(self, request, **kwargs): self.is_authenticated(request) data = request.POST try: comment = models.Comment.objects.get(id=data['commentId']) previous_comment = comment.comment comment.comment = data['commentDescription'] comment.modified_date = datetime.datetime.now() comment.save() update_feedback_activities(comment.feedback_object, SDActions.COMMENT_UPDATE, previous_comment, data['commentDescription'], request.user) return HttpResponse("Success") except Exception as ex: LOG.info("[Exception while modifying comment]: {0}".format(ex)) return HttpResponseNotFound()
def modify_feedback_comments(request, feedback_id, comment_id): data = request.POST feedback_obj = get_model('Feedback').objects.get(id=feedback_id) try: comment = get_model('Comment').objects.get(feedback_object_id=feedback_id, id=comment_id) previous_comment = comment.comment comment.comment = data['commentDescription'] comment.modified_date = datetime.datetime.now() comment.save(using=settings.BRAND) update_feedback_activities(feedback_obj, SDActions.COMMENT_UPDATE, previous_comment, data['commentDescription'], request.user) return HttpResponse("Success") except Exception as ex: LOG.info("[Exception comment not found]: {0}".format(ex)) return HttpResponseNotFound()