From 4ffbeec29d71f7f0adafaf62646498bbed197fe6 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Thu, 12 May 2022 14:23:01 +0200 Subject: [PATCH] Refactor form initialization --- ereuse_devicehub/inventory/views.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/ereuse_devicehub/inventory/views.py b/ereuse_devicehub/inventory/views.py index 795e8266..92a16ff8 100644 --- a/ereuse_devicehub/inventory/views.py +++ b/ereuse_devicehub/inventory/views.py @@ -49,27 +49,22 @@ class DeviceListMix(GenericMixView): if lot_id: lot = lots.filter(Lot.id == lot_id).one() - form_new_action = NewActionForm(lot=lot.id) - form_new_allocate = AllocateForm(lot=lot.id) - form_new_datawipe = DataWipeForm(lot=lot.id) form_new_trade = TradeForm( lot=lot.id, user_to=g.user.email, user_from=g.user.email, ) else: - form_new_action = NewActionForm() - form_new_allocate = AllocateForm() - form_new_datawipe = DataWipeForm() form_new_trade = '' + form_new_action = NewActionForm(lot=lot_id) self.context.update( { 'devices': devices, 'form_tag_device': TagDeviceForm(), 'form_new_action': form_new_action, - 'form_new_allocate': form_new_allocate, - 'form_new_datawipe': form_new_datawipe, + 'form_new_allocate': AllocateForm(lot=lot_id), + 'form_new_datawipe': DataWipeForm(lot=lot_id), 'form_new_trade': form_new_trade, 'form_filter': form_filter, 'form_print_labels': PrintLabelsForm(),