mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-09-01 08:32:13 +00:00
postkey/views.py: fill date_added field with UTC date
This commit is contained in:
parent
dcc6699c33
commit
1a734f5af5
@ -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…
x
Reference in New Issue
Block a user