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})
def create_article(self, title='Test title', content='Test content'): return Article.get_new(title=title, content=content)