Connexion requise
@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})
Testy Thrush