From 462e6fb0adbfc475765da950679a9a9683cda27a Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Tue, 4 Jun 2024 10:28:46 +0200 Subject: forms: set default values to partition and format Add default values to the partition and format form component. Prevent index None from showing in the form when the client has an empty disk with no partitions. Now the form will be created with an entry of index 1 in adition to Type and Filesystem as Empty in that case. --- ogcp/forms/action_forms.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ogcp/forms') diff --git a/ogcp/forms/action_forms.py b/ogcp/forms/action_forms.py index e18de5e..34f06b4 100644 --- a/ogcp/forms/action_forms.py +++ b/ogcp/forms/action_forms.py @@ -31,7 +31,8 @@ class WOLForm(FlaskForm): class PartitionForm(FlaskForm): partition = IntegerField(label=_l('Partition'), - render_kw={'readonly': True}) + render_kw={'readonly': True}, + default=1) part_type = SelectField(label=_l('Type'), choices=[('LINUX', 'Linux'), ('NTFS', 'NTFS'), @@ -47,14 +48,16 @@ class PartitionForm(FlaskForm): ('HNTFS', 'HNTFS'), ('HFAT32', 'HFAT32'), ('HNTFS-WINRE', 'HNTFS-WINRE'), - ('EMPTY', 'Empty')]) + ('EMPTY', 'Empty')], + default='EMPTY') fs = SelectField(label=_l('Filesystem'), choices=[('EXT4', 'EXT4'), ('NTFS', 'NTFS'), ('CACHE', 'CACHE'), ('LINUX-SWAP', 'LINUX-SWAP'), ('FAT32', 'FAT32'), - ('EMPTY', 'Empty')]) + ('EMPTY', 'Empty')], + default='EMPTY') size = IntegerField(label=_l('Size (KB)')) class SelectClientForm(FlaskForm): -- cgit v1.2.3-18-g5258