diff options
author | Dan McGee <dpmcgee@gmail.com> | 2011-05-10 14:38:37 -0500 |
---|---|---|
committer | Dan McGee <dpmcgee@gmail.com> | 2011-05-10 14:38:37 -0500 |
commit | 972b010743e5e8844fda8e9862c85289541eb621 (patch) | |
tree | b03c24cb4c163e7c9d574a5f87180972a0f06178 | |
parent | 3f93b99ad012fecb1929bb250bacb3297c458c5e (diff) |
Ensure releng modules links work correctly
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
-rw-r--r-- | releng/views.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/releng/views.py b/releng/views.py index 0f81948c..a810bbbc 100644 --- a/releng/views.py +++ b/releng/views.py @@ -69,10 +69,13 @@ def submit_test_result(request): context = {'form': form} return direct_to_template(request, 'releng/add.html', context) -def calculate_option_overview(model, is_rollback=False): +def calculate_option_overview(field_name): + field = Test._meta.get_field(field_name) + model = field.rel.to + is_rollback = field_name.startswith('rollback_') option = { 'option': model, - 'name': model._meta.verbose_name, + 'name': field_name, 'is_rollback': is_rollback, 'values': [] } @@ -92,13 +95,11 @@ def test_results_overview(request): # data structure produced: # [ { option, name, is_rollback, values: [ { value, success, failure } ... ] } ... ] all_options = [] - models = [ Architecture, IsoType, BootType, HardwareType, InstallType, - Source, ClockChoice, Filesystem, Module, Bootloader ] - for model in models: - all_options.append(calculate_option_overview(model)) - # now handle rollback options - for model in [ Filesystem, Module ]: - all_options.append(calculate_option_overview(model, True)) + fields = [ 'architecture', 'iso_type', 'boot_type', 'hardware_type', + 'install_type', 'source', 'clock_choice', 'filesystem', 'modules', + 'bootloader', 'rollback_filesystem', 'rollback_modules' ] + for field in fields: + all_options.append(calculate_option_overview(field)) context = { 'options': all_options, |