Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

login_required

@login_required(login_url='login')
def upload_post(request):
    if request.method == 'POST':
        form = PostForm(request.POST)
        if form.is_valid():
            form.save()
            messages.success(request, "Book added successfully")
        return redirect("index")
    else:
        form = PostForm()

    return render(request, 'blog/article_form.html', {"form": form})
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
3+9 =