mirror of https://github.com/r4sas/py-i2phosts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
605 B
23 lines
605 B
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))
|
|
|