diff --git a/.gitignore b/.gitignore index b2318ae..34a591a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ __pycache__/ instance/ uploads/ +zip_exports/ .pytest_cache/ .coverage diff --git a/slaeforms/app.py b/slaeforms/app.py index 0329efb..6ff3040 100644 --- a/slaeforms/app.py +++ b/slaeforms/app.py @@ -42,8 +42,8 @@ app.secret_key = b"29fe9e8edd407c5491d4f1c05632d9fa33e26ed8734a3f5e080ebac3772a5 UPLOAD_FOLDER = 'uploads' EXPORT_FOLDER = 'exports' PASSWORD = '#1ACGmsjd' -# CONFIGFILE = 'userstudy1.json' -CONFIGFILE = 'test.json' +CONFIGFILE = 'userstudy1.json' +# CONFIGFILE = 'test.json' # CONFIGFILE = 'default.json' #csrf = CSRFProtect(app) #enable CSRF protection globally @@ -364,7 +364,19 @@ def sendpage(): setattr(new_entry, "video_upload", video_name) - for key, value in request.form.items(): + # TODO maybe find a prettier solution, this handeles multiple choice now, so the fact that there can be + # multiple keys that are the same in the form data, but I want to bring them together to 1 key value pair + form_data = {} + for key in request.form: + values = request.form.getlist(key) + + # If there's more than one value for the key, join them with commas + if len(values) > 1: + form_data[key] = ','.join(map(str, values)) # Join multiple values into a single comma-separated string + else: + form_data[key] = values[0] # If only one value, store it directly + + for key, value in form_data.items(): print("hasattr key: ", key) if hasattr(new_entry, key): print("key exists: ", key) diff --git a/slaeforms/static/styles.css b/slaeforms/static/styles.css index 026893b..cd2d158 100644 --- a/slaeforms/static/styles.css +++ b/slaeforms/static/styles.css @@ -118,9 +118,7 @@ label { margin-bottom: 1.5rem; } -input, -textarea, -select { +.inputs { margin: 10px 0 0 0; width: 60%; min-height: 2em; diff --git a/slaeforms/templates/standard_template.html b/slaeforms/templates/standard_template.html index db061b8..9af8a0d 100644 --- a/slaeforms/templates/standard_template.html +++ b/slaeforms/templates/standard_template.html @@ -73,7 +73,7 @@ step={{question["step"]}} {% macro input(name, value='', type='text', size=20) -%} + value|e }}" size="{{ size }}" class="inputs"> {%- endmacro %} @@ -132,7 +132,7 @@ step={{question["step"]}}
{% for point in questions[question]["points"] %}