1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-08 22:07:55 +00:00

postkey: add "success" view

This commit is contained in:
Hidden Z 2010-10-06 19:02:08 +00:00
parent 60ba81d91c
commit e191306c7e
2 changed files with 9 additions and 2 deletions

View File

@ -2,4 +2,5 @@ from django.conf.urls.defaults import *
urlpatterns = patterns('web.postkey.views',
(r'^$', 'addkey'),
(r'^success/', 'success'),
)

View File

@ -54,10 +54,16 @@ def addkey(request):
if request.method == 'POST':
form = AddForm(request.POST)
if form.is_valid():
#form.save()
return HttpResponseRedirect('/postkey/success/')
form.save()
request.session['hostname'] = form.cleaned_data['name']
return HttpResponseRedirect('success')
else:
form = AddForm()
return render_to_response('postkey.html', {
'form': form,
}, context_instance=RequestContext(request))
def success(request):
return render_to_response('success_submission.html', {
'hostname': request.session['hostname'],
})