Completed admin views

Corrected model method return values
This commit is contained in:
2022-06-15 11:23:38 +01:00
parent 126bf9203c
commit a1bee61679
6 changed files with 226 additions and 43 deletions

View File

@ -1,4 +1,5 @@
from ..models import Dataset
from ..modules import db
from wtforms.validators import ValidationError
@ -42,4 +43,14 @@ def get_time_options():
('90', '1 hour 30 minutes'),
('120', '2 hours')
]
return time_options
return time_options
def get_dataset_choices():
datasets = Dataset.query.all()
dataset_choices = []
for dataset in datasets:
label = dataset['date'].strftime('%Y%m%d%H%M%S')
label = f'{label} (Default)' if dataset.default else label
choice = (dataset['id'], label)
dataset_choices.append(choice)
return dataset_choices