示例#1
0
def new_article(request):
    form = ArticleForm(request.POST or None)
    if form.is_valid():
        Article.get_new(title=form.cleaned_data["title"], content=form.cleaned_data["content"])
        return redirect("/")
    return render(request, "form.html", {"form": form})
示例#2
0
 def create_article(self, title='Test title', content='Test content'):
     return Article.get_new(title=title, content=content)