diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-05-10 17:03:11 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-05-12 14:59:53 +0200 |
commit | 6034ba2537368f7da0569e7614bd2c7f110457b1 (patch) | |
tree | 6c9f353596a6c78adcc0f37d897c3011f950841b /ogcp/views.py | |
parent | a04ef4e421ec29a3fb2f8181b5c7af381767001c (diff) |
Make partition id non editable in partition form
Show the partition id as a non editable label in each partition
of the Partition and Format form.
Assign sequential partition id from top to down and recalculate
every partition id when a partition is removed.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r-- | ogcp/views.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index fde7590..77402d6 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -659,24 +659,24 @@ def action_setup_modify(): 'cache_size': str(0), 'partition_setup': []} - required_partitions = ["1", "2", "3", "4"] + partition_index = 0 + for partition in form.partitions: - print(partition) - partition_setup = {'partition': str(partition.partition.data), + partition_index += 1 + partition_setup = {'partition': str(partition_index), 'code': str(partition.part_type.data), 'filesystem': str(partition.fs.data), 'size': str(partition.size.data * 1024), 'format': str(int(partition.format_partition.data))} payload['partition_setup'].append(partition_setup) - if partition.partition.data in required_partitions: - required_partitions.remove(partition.partition.data) + if partition.part_type.data == 'CACHE': payload['cache'] = '1' payload['cache_size'] = str(partition.size.data * 1024) - for partition in required_partitions: + for partition_index in range(len(form.partitions) + 1, 5): empty_part = { - 'partition': partition, + 'partition': str(partition_index), 'code': 'EMPTY', 'filesystem': 'EMPTY', 'size': '0', |