You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
3.3 KiB

from flask import render_template, url_for, flash, redirect, request, Blueprint
from minibase import db
from minibase.config import themeMinibase
from minibase.models import Company, Company_industry, Company_legal_entity, Company_relation
from minibase.administration.forms import compLegalEntityForm, compRelationForm, compIndustryForm
# Declaring a blueprint
administration = Blueprint('administration', __name__)
@administration.route("/administration_company_legal_entity", methods=['GET', 'POST'])
def administration_company_legal_entity():
form = compLegalEntityForm()
if form.validate_on_submit():
companyLegal = Company_legal_entity(
name=form.name.data,
description=form.description.data)
# Here we need to give the id of thr role as this is a foreign key
db.session.add(companyLegal)
db.session.commit()
flash(f'{"Company Legal Entity registered!"}', 'success')
return render_template('administration_company_legal_entity.html',
title='Register Company Legal Entity',
theme=themeMinibase,
form=form)
return render_template('administration_company_legal_entity.html',
title='Register Company Legal Entity',
theme=themeMinibase,
form=form)
@administration.route("/administration_company_relation", methods=['GET', 'POST'])
def administration_company_relation():
form = compRelationForm()
if form.validate_on_submit():
companyLegal = Company_relation(
name=form.name.data,
description=form.description.data)
# Here we need to give the id of thr role as this is a foreign key
db.session.add(companyLegal)
db.session.commit()
flash(f'{"Company Relation registered!"}', 'success')
return render_template('administration_company_relation.html',
title='Register Company Relation',
theme=themeMinibase,
form=form)
return render_template('administration_company_relation.html',
title='Register Company Relation',
theme=themeMinibase,
form=form)
@administration.route("/administration_company_industry", methods=['GET', 'POST'])
def administration_company_industry():
form = compIndustryForm()
if form.validate_on_submit():
companyLegal = Company_industry(
name=form.name.data,
description=form.description.data)
# Here we need to give the id of thr role as this is a foreign key
db.session.add(companyLegal)
db.session.commit()
flash(f'{"Company Idustry registered!"}', 'success')
return render_template('administration_company_industry.html',
title='Register Company Industry',
theme=themeMinibase,
form=form)
return render_template('administration_company_industry.html',
title='Register Company Industry',
theme=themeMinibase,
form=form)