コード例 #1
0
def delete_comment(request, note_id, comment_id):
    if request.method == 'POST':
        _note = Note(note_id)
        _note_context = _note.read()
        _comment_context = _note.read_comment(comment_id)
        _user_id = request.user.id

        # 判断当前用户是否具有删除权限
        if _comment_context['creator_id'] == _user_id or _note_context['creator_id'] == _user_id:
            _note.del_comment(comment_id)

            return HttpResponse('1')
コード例 #2
0
def delete_note_comment(request, note_id, comment_id):
    _note = Note(note_id)
    _note.del_comment(comment_id)
    return HttpResponseRedirect(request.META['HTTP_REFERER'])
コード例 #3
0
 def run(self, note_id, comment_id):
     _note = Note(note_id)
     _note.del_comment(comment_id)