summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-06-04 10:28:46 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-06-04 17:14:08 +0200
commit462e6fb0adbfc475765da950679a9a9683cda27a (patch)
tree1459b09d4b2a3fbf7bcb4ca5c94e7ee6c563ebc8
parent43e3346a4a0a2e2f1cea1c3d6f03bfab780a636f (diff)
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.
-rw-r--r--ogcp/forms/action_forms.py9
1 files changed, 6 insertions, 3 deletions
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):