Browse Source

postkey: add "success" view

pull/1/head
Hidden Z 14 years ago
parent
commit
e191306c7e
  1. 1
      web/postkey/urls.py
  2. 10
      web/postkey/views.py

1
web/postkey/urls.py

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

10
web/postkey/views.py

@ -54,10 +54,16 @@ def addkey(request): @@ -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'],
})

Loading…
Cancel
Save