def edit_article request title article Article objects get title title

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
def edit_article(request, title):
article = Article.objects.get(title=title)
if request.method == 'POST':
form = ArticleForm(request.POST, instance=article)
if form.is_valid():
new_article = form.save()
if new_article == article:
return HttpResponse("wtf?")