mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-23 20:06:35 +11:00
Decoupled functions
This commit is contained in:
parent
f3b5bad47c
commit
faf840a113
1 changed files with 4 additions and 2 deletions
|
@ -23,7 +23,8 @@ def snippet_new(request, template_name='dpaste/snippet_new.html'):
|
||||||
snippet_form = SnippetForm(data=request.POST, request=request)
|
snippet_form = SnippetForm(data=request.POST, request=request)
|
||||||
if snippet_form.is_valid():
|
if snippet_form.is_valid():
|
||||||
request, new_snippet = snippet_form.save()
|
request, new_snippet = snippet_form.save()
|
||||||
return HttpResponseRedirect(new_snippet.get_absolute_url())
|
url = new_snippet.get_absolute_url()
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
else:
|
else:
|
||||||
snippet_form = SnippetForm(request=request)
|
snippet_form = SnippetForm(request=request)
|
||||||
|
|
||||||
|
@ -62,7 +63,8 @@ def snippet_details(request, snippet_id, template_name='dpaste/snippet_details.h
|
||||||
snippet_form = SnippetForm(data=request.POST, request=request, initial=new_snippet_initial)
|
snippet_form = SnippetForm(data=request.POST, request=request, initial=new_snippet_initial)
|
||||||
if snippet_form.is_valid():
|
if snippet_form.is_valid():
|
||||||
request, new_snippet = snippet_form.save(parent=snippet)
|
request, new_snippet = snippet_form.save(parent=snippet)
|
||||||
return HttpResponseRedirect(new_snippet.get_absolute_url())
|
url = new_snippet.get_absolute_url()
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
else:
|
else:
|
||||||
snippet_form = SnippetForm(initial=new_snippet_initial, request=request)
|
snippet_form = SnippetForm(initial=new_snippet_initial, request=request)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue