43 lines
836 B
Python
43 lines
836 B
Python
"""entreprises.__init__
|
|
"""
|
|
|
|
from flask import Blueprint
|
|
from app.scodoc import sco_etud
|
|
from app.auth.models import User
|
|
from app.models import Departement
|
|
|
|
bp = Blueprint("entreprises", __name__)
|
|
|
|
LOGS_LEN = 5
|
|
|
|
|
|
@bp.app_template_filter()
|
|
def format_prenom(s):
|
|
return sco_etud.format_prenom(s)
|
|
|
|
|
|
@bp.app_template_filter()
|
|
def format_nom(s):
|
|
return sco_etud.format_nom(s)
|
|
|
|
|
|
@bp.app_template_filter()
|
|
def get_nomcomplet_by_username(s):
|
|
user = User.query.filter_by(user_name=s).first()
|
|
return user.get_nomcomplet()
|
|
|
|
|
|
@bp.app_template_filter()
|
|
def get_nomcomplet_by_id(id):
|
|
user = User.query.filter_by(id=id).first()
|
|
return user.get_nomcomplet()
|
|
|
|
|
|
@bp.app_template_filter()
|
|
def get_dept_acronym(id):
|
|
dept = Departement.query.filter_by(id=id).first()
|
|
return dept.acronym
|
|
|
|
|
|
from app.entreprises import routes
|