fix the new version of dispatch for NewDataWipeView

This commit is contained in:
Cayo Puigdefabregas 2022-02-09 11:27:08 +01:00
parent d102eaed9c
commit 1ed5d394c5
1 changed files with 9 additions and 4 deletions

View File

@ -336,12 +336,17 @@ class NewAllocateView(NewActionView, DeviceListMix):
class NewDataWipeView(NewActionView, DeviceListMix):
methods = ['POST']
_form = DataWipeForm
form_class = DataWipeForm
def dispatch_request(self):
dispatch = super().dispatch_request()
if dispatch:
return dispatch
self.form = self.form_class()
if self.form.validate_on_submit():
instance = self.form.save()
messages.success('Action "{}" created successfully!'.format(instance.type))
next_url = self.get_next_url()
return flask.redirect(next_url)
lot_id = self.form.lot.data
self.get_context(lot_id)