From 972b010743e5e8844fda8e9862c85289541eb621 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 10 May 2011 14:38:37 -0500 Subject: Ensure releng modules links work correctly Signed-off-by: Dan McGee --- releng/views.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'releng') 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, -- cgit v1.2.3-54-g00ecf