Added decorator to test availability of datasets

Used decorator tool to validate dataset exists on views
This commit is contained in:
2022-08-17 16:37:03 +01:00
parent 2da8eb7712
commit be5343a4bd
3 changed files with 20 additions and 6 deletions

View File

@ -1,6 +1,7 @@
from ..forms.admin import EditDataset
from ..models import Dataset, User
from ..tools.forms import get_dataset_choices, send_errors_to_client
from ..tools.data import check_dataset_exists
from flask import Blueprint, flash, jsonify, redirect, render_template, request
from flask.helpers import url_for
@ -27,6 +28,7 @@ def _editor():
return render_template('/editor/index.html', form=form)
@editor.route('/<string:id>/')
@check_dataset_exists
@login_required
def _editor_console(id:str=None):
dataset = Dataset.query.filter_by(id=id).first()