mirror of
https://github.com/sartography/protocol-builder-mock.git
synced 2025-02-11 15:16:44 +00:00
Fixing a bug that prevented editing existing studies.
This commit is contained in:
parent
4ea5340248
commit
d5b2decd89
6
app.py
6
app.py
@ -193,8 +193,10 @@ def _update_study(study, form):
|
||||
# quick hack to get auto-increment without creating a bunch of hassle, this is not
|
||||
# production code by any stretch of the imagination, but this is a throw away library.
|
||||
max_id = db.session.query(func.max(Study.STUDYID)).scalar() or 1
|
||||
|
||||
study.STUDYID = max_id + 1
|
||||
if not form.STUDYID.data:
|
||||
study.STUDYID = max_id + 1
|
||||
else:
|
||||
study.STUDYID = form.STUDYID.data
|
||||
study.TITLE = form.TITLE.data
|
||||
study.NETBADGEID = form.NETBADGEID.data
|
||||
study.DATE_MODIFIED = datetime.datetime.now()
|
||||
|
3
forms.py
3
forms.py
@ -3,13 +3,14 @@ import sys
|
||||
from flask_table import Table, Col, DateCol, LinkCol, BoolCol, DatetimeCol, NestedTableCol
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import SelectMultipleField, SubmitField, StringField, IntegerField, BooleanField, DateField, widgets, \
|
||||
SelectField, validators
|
||||
SelectField, validators, HiddenField
|
||||
from wtforms_alchemy import ModelForm
|
||||
|
||||
from models import RequiredDocument, Investigator, StudyDetails
|
||||
|
||||
|
||||
class StudyForm(FlaskForm):
|
||||
STUDYID = HiddenField()
|
||||
TITLE = StringField('Title', [validators.required()])
|
||||
NETBADGEID = StringField('User UVA Computing Id', [validators.required()])
|
||||
requirements = SelectMultipleField("Requirements",
|
||||
|
Loading…
x
Reference in New Issue
Block a user