mirror of https://github.com/r4sas/py-i2phosts
Hidden Z
14 years ago
2 changed files with 28 additions and 0 deletions
@ -0,0 +1,5 @@
@@ -0,0 +1,5 @@
|
||||
from django.conf.urls.defaults import * |
||||
|
||||
urlpatterns = patterns('web.postkey.views', |
||||
(r'^$', 'index'), |
||||
) |
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
from django.shortcuts import render_to_response |
||||
from django.http import HttpResponseRedirect |
||||
from django.forms import ModelForm |
||||
from django.template import RequestContext |
||||
|
||||
from web.postkey.models import i2phost |
||||
|
||||
class AddForm(ModelForm): |
||||
class Meta: |
||||
model = i2phost |
||||
fields = ('name', 'b64hash') |
||||
|
||||
def index(request): |
||||
if request.method == 'POST': |
||||
form = AddForm(request.POST) |
||||
if form.is_valid(): |
||||
form.save() |
||||
return HttpResponseRedirect('/postkey/success/') |
||||
else: |
||||
form = AddForm() |
||||
return render_to_response('postkey.html', { |
||||
'form': form, |
||||
}, context_instance=RequestContext(request)) |
Loading…
Reference in new issue