예제 #1
0
파일: views.py 프로젝트: nicomak/blog
def create_post(request):
    if request.method == 'POST':
        new_content = request.POST.get('content', '')
        PostModel.create_post(request.user.username, content=new_content)
        return redirect('posts_list')
    else:
        return render(request, 'posts/create.html')
예제 #2
0
def create_post(request):
    if request.method == 'POST':
        new_content = request.POST.get('content', '')
        PostModel.create_post(request.user.username, content=new_content)
        return redirect('posts_list')
    else:
        return render(request, 'posts/create.html')
예제 #3
0
파일: views.py 프로젝트: nicomak/blog
def list_posts(request):
    posts = PostModel.select_user_latest_with_date(request.user.username)
    #logger.info("Listed %d posts", len(posts))
    return render(request, 'posts/list.html', {'posts': posts})
예제 #4
0
def list_posts(request):
    posts = PostModel.select_user_latest_with_date(request.user.username)
    #logger.info("Listed %d posts", len(posts))
    return render(request, 'posts/list.html', {'posts': posts})