def event_add():
form = EventForm()
form.confidence.choices = [(i, '%s' % i) for i in xrange(0, 100, 5)]
if form.validate_on_submit():
ev = Event(form.name.data,
form.details.data,
form.source.data,
form.tlp.data,
form.impact.data,
form.likelihood.data,
form.confidence.data)
db.session.add(ev)
try:
db.session.commit()
flash('Event added')
except IntegrityError:
db.session.rollback()
flash('Commit Error')
return redirect('/index')
print(form.errors)
return render_template('event_add.html',
title='Add Event',
form=form)
评论列表
文章目录