type to message from form.type.data instead of instance

This commit is contained in:
Cayo Puigdefabregas 2022-02-10 13:31:49 +01:00
parent f3ffcd89ca
commit adad689acd

View file

@ -311,11 +311,9 @@ class NewActionView(View):
def dispatch_request(self):
self.form = self.form_class()
# import pdb; pdb.set_trace()
if self.form.validate_on_submit():
instance = self.form.save()
messages.success('Action "{}" created successfully!'.format(instance.type))
messages.success('Action "{}" created successfully!'.format(self.form.type.data))
next_url = self.get_next_url()
return flask.redirect(next_url)
@ -337,8 +335,7 @@ class NewAllocateView(NewActionView, DeviceListMix):
self.form = self.form_class()
if self.form.validate_on_submit():
instance = self.form.save()
messages.success('Action "{}" created successfully!'.format(instance.type))
messages.success('Action "{}" created successfully!'.format(self.form.type.data))
next_url = self.get_next_url()
return flask.redirect(next_url)
@ -357,8 +354,7 @@ class NewDataWipeView(NewActionView, DeviceListMix):
self.form = self.form_class()
if self.form.validate_on_submit():
instance = self.form.save()
messages.success('Action "{}" created successfully!'.format(instance.type))
messages.success('Action "{}" created successfully!'.format(self.form.type.data))
next_url = self.get_next_url()
return flask.redirect(next_url)
@ -377,8 +373,7 @@ class NewTradeView(NewActionView, DeviceListMix):
self.form = self.form_class()
if self.form.validate_on_submit():
instance = self.form.save()
messages.success('Action "{}" created successfully!'.format(instance.type))
messages.success('Action "{}" created successfully!'.format(self.form.type.data))
next_url = self.get_next_url()
return flask.redirect(next_url)