type to message from form.type.data instead of instance
This commit is contained in:
parent
f3ffcd89ca
commit
adad689acd
|
@ -311,11 +311,9 @@ class NewActionView(View):
|
||||||
|
|
||||||
def dispatch_request(self):
|
def dispatch_request(self):
|
||||||
self.form = self.form_class()
|
self.form = self.form_class()
|
||||||
# import pdb; pdb.set_trace()
|
|
||||||
|
|
||||||
if self.form.validate_on_submit():
|
if self.form.validate_on_submit():
|
||||||
instance = self.form.save()
|
messages.success('Action "{}" created successfully!'.format(self.form.type.data))
|
||||||
messages.success('Action "{}" created successfully!'.format(instance.type))
|
|
||||||
|
|
||||||
next_url = self.get_next_url()
|
next_url = self.get_next_url()
|
||||||
return flask.redirect(next_url)
|
return flask.redirect(next_url)
|
||||||
|
@ -337,8 +335,7 @@ class NewAllocateView(NewActionView, DeviceListMix):
|
||||||
self.form = self.form_class()
|
self.form = self.form_class()
|
||||||
|
|
||||||
if self.form.validate_on_submit():
|
if self.form.validate_on_submit():
|
||||||
instance = self.form.save()
|
messages.success('Action "{}" created successfully!'.format(self.form.type.data))
|
||||||
messages.success('Action "{}" created successfully!'.format(instance.type))
|
|
||||||
|
|
||||||
next_url = self.get_next_url()
|
next_url = self.get_next_url()
|
||||||
return flask.redirect(next_url)
|
return flask.redirect(next_url)
|
||||||
|
@ -357,8 +354,7 @@ class NewDataWipeView(NewActionView, DeviceListMix):
|
||||||
self.form = self.form_class()
|
self.form = self.form_class()
|
||||||
|
|
||||||
if self.form.validate_on_submit():
|
if self.form.validate_on_submit():
|
||||||
instance = self.form.save()
|
messages.success('Action "{}" created successfully!'.format(self.form.type.data))
|
||||||
messages.success('Action "{}" created successfully!'.format(instance.type))
|
|
||||||
|
|
||||||
next_url = self.get_next_url()
|
next_url = self.get_next_url()
|
||||||
return flask.redirect(next_url)
|
return flask.redirect(next_url)
|
||||||
|
@ -377,8 +373,7 @@ class NewTradeView(NewActionView, DeviceListMix):
|
||||||
self.form = self.form_class()
|
self.form = self.form_class()
|
||||||
|
|
||||||
if self.form.validate_on_submit():
|
if self.form.validate_on_submit():
|
||||||
instance = self.form.save()
|
messages.success('Action "{}" created successfully!'.format(self.form.type.data))
|
||||||
messages.success('Action "{}" created successfully!'.format(instance.type))
|
|
||||||
|
|
||||||
next_url = self.get_next_url()
|
next_url = self.get_next_url()
|
||||||
return flask.redirect(next_url)
|
return flask.redirect(next_url)
|
||||||
|
|
Reference in New Issue