Browse Source

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

pull/1/head
Hidden Z 14 years ago
parent
commit
1a734f5af5
  1. 5
      pyi2phosts/postkey/views.py

5
pyi2phosts/postkey/views.py

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

Loading…
Cancel
Save