Compare commits

..

7 Commits

6 changed files with 8 additions and 11 deletions

View File

@ -77,7 +77,7 @@ $('.test-action').click(function(event) {
$.ajax({ $.ajax({
url: `/admin/tests/edit/`, url: `/admin/tests/edit/`,
type: 'POST', type: 'POST',
data: JSON.stringify({'id': id, 'action': action}), // TODO Change how CRUD operations work data: JSON.stringify({'id': id, 'action': action}),
contentType: 'application/json', contentType: 'application/json',
success: function(response) { success: function(response) {
window.location.href = '/admin/tests/'; window.location.href = '/admin/tests/';

View File

@ -214,7 +214,7 @@ def _questions():
if form.validate_on_submit(): if form.validate_on_submit():
upload = form.data_file.data upload = form.data_file.data
if not check_is_json(upload): return jsonify({'error': 'Invalid file. Please upload a JSON file.'}), 400 if not check_is_json(upload): return jsonify({'error': 'Invalid file. Please upload a JSON file.'}), 400
if not validate_json(upload): return jsonify({'error': 'The data in the file is invalid.'}), 400 # TODO Perhaps make a more complex validation script if not validate_json(upload): return jsonify({'error': 'The data in the file is invalid.'}), 400
new_dataset = Dataset() new_dataset = Dataset()
success, message = new_dataset.create( success, message = new_dataset.create(
upload = upload, upload = upload,

View File

@ -28,10 +28,10 @@ class Config(object):
MAIL_SUPPRESS_SEND = False MAIL_SUPPRESS_SEND = False
MAIL_ASCII_ATTACHMENTS = bool(os.getenv('MAIL_ASCII_ATTACHMENTS')) MAIL_ASCII_ATTACHMENTS = bool(os.getenv('MAIL_ASCII_ATTACHMENTS'))
class ProductionConfig(Config): class Production(Config):
pass pass
class DevelopmentConfig(Config): class Development(Config):
APP_HOST = '127.0.0.1' APP_HOST = '127.0.0.1'
DEBUG = True DEBUG = True
SESSION_COOKIE_SECURE = False SESSION_COOKIE_SECURE = False
@ -39,7 +39,7 @@ class DevelopmentConfig(Config):
MAIL_DEBUG = True MAIL_DEBUG = True
MAIL_SUPPRESS_SEND = False MAIL_SUPPRESS_SEND = False
class TestingConfig(DevelopmentConfig): class Testing(Development):
TESTING = True TESTING = True
SESSION_COOKIE_SECURE = False SESSION_COOKIE_SECURE = False
MAIL_SERVER = os.getenv('MAIL_SERVER') MAIL_SERVER = os.getenv('MAIL_SERVER')

View File

@ -1 +1 @@
from app.config import DevelopmentConfig as Config from app.config import Development as Config

View File

@ -82,5 +82,4 @@ def create_app():
app = create_app() app = create_app()
if __name__ == '__main__': if __name__ == '__main__': app.run()
app.run()

View File

@ -1,4 +1,2 @@
from main import app from main import app
if __name__ == '__main__': app.run()
if __name__ == '__main__':
app.run()