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.
master
Alejandro Sirgo Rica 2024-06-04 10:28:46 +02:00
parent 43e3346a4a
commit 462e6fb0ad
1 changed files with 6 additions and 3 deletions

View File

@ -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):