class_management_system

Senior Project - Spring 2019
Log | Files | Refs | README

commit bd7b89159aeb701ee42afe4a78dbc019c892a414
parent b8a4718e11b421b2311366f914374eb092edaa8a
Author: KyleButera <buterak0@students.rowan.edu>
Date:   Thu, 11 Apr 2019 13:36:04 -0400

Merge branch 'origin/DBconnections'

Diffstat:
Asrc/database/propman_db_model.py | 31+++++++++++++++++++++++++++++++
Asrc/database/propman_flask_app.py | 16++++++++++++++++
2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/src/database/propman_db_model.py b/src/database/propman_db_model.py @@ -0,0 +1,31 @@ +from sqlalchemy.ext.automap import automap_base +from sqlalchemy import create_engine +from sqlalchemy.inspection import inspect + +engine = create_engine('mysql+pymysql://cs_user:happy29july@localhost/propman', isolation_level='READ_COMMITTED') +Base = automap_base() +Base.prepare(engine, reflect=True) + +#Mapped classes +Consult_letter = Base.classes.consult_letter +Consult_letter_revision = Base.classes.consult_letter_revision +Assessement_form = Base.classes.assessment_form +Assessement_form_Revision = Base.classes.assessement_form_revision +Employee = Base.classes.employee +Library_form = Base.classes.library_form +Library_form_revision = Base.classes.library_form_revision +Proposal = Base.classes.proposal +Sponsor = Base.classes.sponsor +Supporting_document = Base.classes.supporting_document +Supporting_document_revision = Base.classes.supporting_document_revision +Program_guide = Base.classes.program_guide +Program_guide_revision = Base.classes.program_guide_revision + +#Check mapped relationships +''' +classes = [Consult_letter, Consult_letter_revision, Assessment_form, Assessment_form_revision, Employee, Library_form, Library_form_revision, Proposal, Sponsor, Supporting_document, Supporting_document_revision, Program_guide, Program_guide_revision] + +for c in classes: + print('Relationships for %s' % str(c)) + print(inspect(c).relationships.items()) +''' diff --git a/src/database/propman_flask_app.py b/src/database/propman_flask_app.py @@ -0,0 +1,16 @@ +from flask import Flask, render_template, request, redirect, url_for, flash, Blueprint +from propman_session import DBSession +from propman_db_model import Consult_letter, Consult_letter_revision, Assessment_form, Assessment_form_revision, Employee, Library_form, Library_form_revision, Proposal, Sponsor, Supporting_document, Supporting_document_revision, Program_guide, Program_guide_revision +from sqlalchemy import and_ + +app = Flask(__name__) +session = DBSession() +bp = Blueprint('propman', __name__, template_folder='templates', static_folder='static') + +temp_path = './propman' + +@app.route('/') +@bp.route('/') +def propman(): + return render_template('%s/propman.html' % temp_path) +