def admin_article(request): if request.method == "POST": form = ArticleForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect("./") else: form = ArticleForm() articles = Article.objects.all() return render_to_response( "corruption/admin/article.html", {"articles": articles, "form": form}, context_instance=RequestContext(request) )
def admin_view_article(request, article_id): try: article = Article.objects.get(pk=article_id) except ObjectDoesNotExist: raise Http404 if request.method == "POST": form = ArticleForm(request.POST, instance=article) if form.is_valid(): form.save() return HttpResponseRedirect("./") else: form = ArticleForm(instance=article) return render_to_response( "corruption/admin/view_article.html", {"article": article, "form": form}, context_instance=RequestContext(request), )
def admin_article(request): if request.method == "POST": form = ArticleForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect('./') else: form = ArticleForm() articles = Article.objects.all() return render_to_response("corruption/admin/article.html", { "articles": articles, "form": form, }, context_instance=RequestContext(request))
def admin_view_article(request, article_id): try: article = Article.objects.get(pk=article_id) except ObjectDoesNotExist: raise Http404 if request.method == "POST": form = ArticleForm(request.POST, instance=article) if form.is_valid(): form.save() return HttpResponseRedirect('./') else: form = ArticleForm(instance=article) return render_to_response("corruption/admin/view_article.html", { "article": article, "form": form, }, context_instance=RequestContext(request))