Пример #1
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')
Пример #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
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})