mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-23 11:56:36 +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)
|
||||
if snippet_form.is_valid():
|
||||
request, new_snippet = snippet_form.save()
|
||||
return HttpResponseRedirect(new_snippet.get_absolute_url())
|
||||
url = new_snippet.get_absolute_url()
|
||||
return HttpResponseRedirect(url)
|
||||
else:
|
||||
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)
|
||||
if snippet_form.is_valid():
|
||||
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:
|
||||
snippet_form = SnippetForm(initial=new_snippet_initial, request=request)
|
||||
|
||||
|
|
Loading…
Reference in a new issue