From 11ffb78a95d27ebf8ed0b238cde640028eff8e25 Mon Sep 17 00:00:00 2001 From: Nico von Geyso Date: Wed, 15 Aug 2012 16:16:43 +0200 Subject: refactoring --- app.py | 13 +++---------- templates/module_show.html | 3 ++- templates/upload.html | 32 +++++++++++++++----------------- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/app.py b/app.py index 51249de..baaf3d2 100644 --- a/app.py +++ b/app.py @@ -96,17 +96,10 @@ def upload(study, module = None): return redirect(url_for('study_index', study = study, module = module)) - module_list = None - if module: - try: form.module.data = [k for (k,v) in form.module.choices if v == module][0] - except: pass - - print(form.module.data) - module_list = fit[study].get_module(module) + try: form.module.data = [k for (k,v) in form.module.choices if v == module][0] + except: pass - return render_template('upload.html', - study = study, form = form, module_list = module_list, module=module - ) + return render_template('upload.html', study = study, form = form) diff --git a/templates/module_show.html b/templates/module_show.html index 9e7e336..ea27e05 100644 --- a/templates/module_show.html +++ b/templates/module_show.html @@ -6,7 +6,8 @@ diff --git a/templates/upload.html b/templates/upload.html index a248040..8683be0 100644 --- a/templates/upload.html +++ b/templates/upload.html @@ -38,13 +38,7 @@

-
- {% if module and module_list %} -

{{module}}

- {% from 'module_show.html' import render_module_list %} - {{ render_module_list(module_list)}} - {% endif %} -
+