1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-03-09 20:01:18 +00:00

postkey/views.py: fill date_added field with UTC date

This commit is contained in:
Hidden Z 2010-11-15 19:02:56 +00:00
parent dcc6699c33
commit 1a734f5af5

View File

@ -1,4 +1,5 @@
import re
import datetime
from django import forms
from django.shortcuts import render_to_response
@ -47,7 +48,9 @@ def addkey(request):
form = AddForm(request.POST)
if form.is_valid():
log.debug('submit is valid, saving')
form.save()
newhost = form.save(commit=False)
newhost.date_added = datetime.datetime.utcnow()
newhost.save()
request.session['hostname'] = form.cleaned_data['name']
return redirect('pyi2phosts.postkey.views.success')
else: