Refactor form initialization

This commit is contained in:
Santiago L 2022-05-12 14:23:01 +02:00
parent 3e33b7d63b
commit 4ffbeec29d
1 changed files with 3 additions and 8 deletions

View File

@ -49,27 +49,22 @@ class DeviceListMix(GenericMixView):
if lot_id: if lot_id:
lot = lots.filter(Lot.id == lot_id).one() 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( form_new_trade = TradeForm(
lot=lot.id, lot=lot.id,
user_to=g.user.email, user_to=g.user.email,
user_from=g.user.email, user_from=g.user.email,
) )
else: else:
form_new_action = NewActionForm()
form_new_allocate = AllocateForm()
form_new_datawipe = DataWipeForm()
form_new_trade = '' form_new_trade = ''
form_new_action = NewActionForm(lot=lot_id)
self.context.update( self.context.update(
{ {
'devices': devices, 'devices': devices,
'form_tag_device': TagDeviceForm(), 'form_tag_device': TagDeviceForm(),
'form_new_action': form_new_action, 'form_new_action': form_new_action,
'form_new_allocate': form_new_allocate, 'form_new_allocate': AllocateForm(lot=lot_id),
'form_new_datawipe': form_new_datawipe, 'form_new_datawipe': DataWipeForm(lot=lot_id),
'form_new_trade': form_new_trade, 'form_new_trade': form_new_trade,
'form_filter': form_filter, 'form_filter': form_filter,
'form_print_labels': PrintLabelsForm(), 'form_print_labels': PrintLabelsForm(),