Пример #1
0
def post_modify(request, board_url, post_id):
    try:
        board_post = BoardPost.objects.filter(id=post_id)[0]
        if request.user.userprofile != board_post.author:
            return
    except:
        return
    if request.method == 'POST':
        post_id = _write_post(request, 'Post', modify=True)
        if post_id:
            querystring = _get_querystring(request)
            return redirect('../' + querystring)
        return redirect('../')
    post = _get_content(request, post_id)[0]
    post['new'] = False
    current_board = _get_current_board(request, board_url)
    board_list = _get_board_list()
    # official=request.user.userprofile.is_official
    categories = BoardCategory.objects.all()
    return render(
        request, 'board/board_write.html', {
            "post": post,
            "board_list": board_list,
            "current_board": current_board,
            "Categories": categories
        })
Пример #2
0
def post_list(request, board_url):
    get_post_list = _get_post_list(request, board_url)
    post_list = get_post_list[0]
    paginator = get_post_list[1]
    board_list = _get_board_list()
    querystring = _get_querystring(request)
    current_board = _get_current_board(request, board_url)
    adult_filter = request.GET.get('adult_filter')
    is_adult = False
    if adult_filter == "true":
        is_adult = True
    return render(
        request, 'board/board_list.html', {
            'post_list': post_list,
            'board_list': board_list,
            'current_board': current_board,
            'is_adult': is_adult,
            'querystring': querystring,
            'paginator': paginator,
        })
Пример #3
0
def post_list(request, board_url):
    get_post_list = _get_post_list(request, board_url)
    post_list = get_post_list[0]
    paginator = get_post_list[1]
    board_list = _get_board_list()
    querystring = _get_querystring(request)
    current_board = _get_current_board(request, board_url)
    adult_filter = request.GET.get('adult_filter')
    is_adult = False
    if adult_filter == "true":
        is_adult = True
    return render(request,
                  'board/board_list.html',
                  {
                      'post_list': post_list,
                      'board_list': board_list,
                      'current_board': current_board,
                      'is_adult': is_adult,
                      'querystring': querystring,
                      'paginator': paginator,
                  })
Пример #4
0
def post_read(request, board_url, post_id):
    get_content = _get_content(request, post_id)
    post = get_content[0]
    comment_list = get_content[1]
    get_post_list = _get_post_list(request, board_url)
    post_list = get_post_list[0]
    paginator = get_post_list[1]
    board_list = _get_board_list()
    querystring = _get_querystring(request)
    current_board = _get_current_board(request, board_url)
    return render(request,
                  'board/board_read.html',
                  {
                      'querystring': querystring,
                      'post': post,  # post for post
                      'comment_list': comment_list,  # comment for post
                      # Below,there are thing for postList.
                      'post_list': post_list,
                      'board_list': board_list,
                      'current_board': current_board,
                      'paginator': paginator,
                  })
Пример #5
0
def post_read(request, board_url, post_id):
    get_content = _get_content(request, post_id)
    post = get_content[0]
    comment_list = get_content[1]
    get_post_list = _get_post_list(request, board_url)
    post_list = get_post_list[0]
    paginator = get_post_list[1]
    board_list = _get_board_list()
    querystring = _get_querystring(request)
    current_board = _get_current_board(request, board_url)
    return render(
        request,
        'board/board_read.html',
        {
            'querystring': querystring,
            'post': post,  # post for post
            'comment_list': comment_list,  # comment for post
            # Below,there are thing for postList.
            'post_list': post_list,
            'board_list': board_list,
            'current_board': current_board,
            'paginator': paginator,
        })
Пример #6
0
def post_modify(request, board_url, post_id):
    try:
        board_post = BoardPost.objects.filter(id=post_id)[0]
        if request.user.userprofile != board_post.author:
            return
    except:
        return
    if request.method == 'POST':
        post_id = _write_post(request, 'Post', modify=True)
        if post_id:
            querystring = _get_querystring(request)
            return redirect('../'+querystring)
        return redirect('../')
    post = _get_content(request, post_id)[0]
    post['new'] = False
    current_board = _get_current_board(request, board_url)
    board_list = _get_board_list()
    # official=request.user.userprofile.is_official
    categories = BoardCategory.objects.all()
    return render(request,
                  'board/board_write.html',
                  {"post": post, "board_list": board_list,
                   "current_board": current_board,
                   "Categories": categories})
Пример #7
0
def comment_write(request, post_id_check):
    if request.method == 'POST':
        post_id = _write_post(request, 'Comment', post_id_check)
    querystring = _get_querystring(request)
    return redirect('../' + querystring)
Пример #8
0
def re_comment_write(request):
    if request.method == 'POST':
        post_id = _write_post(request, 'Re-Comment')
    querystring = _get_querystring(request)
    return redirect('../' + querystring)
Пример #9
0
def comment_write(request, post_id_check):
    if request.method == 'POST':
        post_id = _write_post(request, 'Comment', post_id_check)
    querystring = _get_querystring(request)
    return redirect('../'+querystring)
Пример #10
0
def re_comment_write(request):
    if request.method == 'POST':
        post_id = _write_post(request, 'Re-Comment')
    querystring = _get_querystring(request)
    return redirect('../'+querystring)