#!/usr/bin/env python
import os
from app import create_app, db
from app.models import (
    User, Role, Admission, Symptom, ObservedSymptom, Vaccine, Method, Sample,
    Patient, CdcExam, Hospitalization, UTIHospitalization, ClinicalEvolution,
    Country, Region, State, City, Address,
)
from flask_script import Manager, Shell
from flask_migrate import Migrate, MigrateCommand
from flask_admin import Admin
from flask_admin.contrib.sqla import ModelView


app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
migrate = Migrate(app, db)
admin = Admin(app, name='labsys', template_mode='bootstrap3')

# region Add ModelView
admin.add_views(
    ModelView(User, db.session),
    ModelView(Role, db.session),
    ModelView(Admission, db.session),
    ModelView(Patient, db.session),
    ModelView(Vaccine, db.session),
    ModelView(Hospitalization, db.session),
    ModelView(UTIHospitalization, db.session),
    ModelView(ClinicalEvolution, db.session),
    ModelView(Symptom, db.session),
    ModelView(ObservedSymptom, db.session),
    ModelView(Method, db.session),
    ModelView(Sample, db.session),
    ModelView(Country, db.session),
    ModelView(Region, db.session),
    ModelView(State, db.session),
    ModelView(City, db.session),
    ModelView(Address, db.session),
)
# endregion


def make_shell_context():
    return dict(
        app=app,
        db=db,
    )


manager.add_command("shell", Shell(make_context=make_shell_context))
manager.add_command('db', MigrateCommand)


@manager.command
def test():
    """Run the unit tests."""
    import unittest
    tests = unittest.TestLoader().discover('tests')
    unittest.TextTestRunner(verbosity=2).run(tests)


@manager.command
def load_initial_data():
    """Load initial models data"""
    import app.data_loader as dl
    dl.load_data(db)


if __name__ == '__main__':
    manager.run()

#!/usr/bin/env python
import os
from app import create_app, db
from app.models import (
    User, Role, Admission, Symptom, ObservedSymptom, Vaccine, Method, Sample,
    Patient, CdcExam, Hospitalization, UTIHospitalization, ClinicalEvolution,
    Country, Region, State, City, Address,
)
from flask_script import Manager, Shell
from flask_migrate import Migrate, MigrateCommand
from flask_admin import Admin
from flask_admin.contrib.sqla import ModelView


app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
migrate = Migrate(app, db)
admin = Admin(app, name='labsys', template_mode='bootstrap3')

# region Add ModelView
admin.add_views(
    ModelView(User, db.session),
    ModelView(Admission, db.session),
    ModelView(Patient, db.session),
    ModelView(Address, db.session),
    ModelView(Sample, db.session),
    ModelView(CdcExam, db.session),
    ModelView(Vaccine, db.session),
    ModelView(Hospitalization, db.session),
    ModelView(UTIHospitalization, db.session),
    ModelView(ClinicalEvolution, db.session),
    ModelView(ObservedSymptom, db.session),
    ModelView(Method, db.session),
    ModelView(Symptom, db.session),
    ModelView(Country, db.session),
    ModelView(Region, db.session),
    ModelView(State, db.session),
    ModelView(City, db.session),
    ModelView(Role, db.session),
)
# endregion


def make_shell_context():
    return dict(
        app=app,
        db=db,
    )


manager.add_command("shell", Shell(make_context=make_shell_context))
manager.add_command('db', MigrateCommand)


@manager.command
def test():
    """Run the unit tests."""
    import unittest
    tests = unittest.TestLoader().discover('tests')
    unittest.TextTestRunner(verbosity=2).run(tests)


@manager.command
def load_initial_data():
    """Load initial models data"""
    import app.data_loader as dl
    dl.load_data(db)


if __name__ == '__main__':
    manager.run()

Reorder FlaskAdmin tabs