Пример #1
0
def inject_admin():
    data = {}
    message = Message.query.order_by(desc(Message.created_at)).first()
    if current_user_is_logged():
        groups = Group.query.order_by(Group.title).order_by(Group.year, Group.title).all()
        admin_groups = OrderedDict()
        for year in Group.active_years():
            admin_groups[year] = [group for group in groups if group.year == year]

        data = {
            'current_year': Group.current_year(),
            'admin_groups': admin_groups,
            'admin_disciplines': Discipline.query.all(),
        }
    data.update({
        'message': message,
    })
    return data
Пример #2
0
def inject_admin():
    data = {}
    message = Message.query.order_by(desc(Message.created_at)).first()
    if current_user_is_logged():
        groups = Group.query.order_by(Group.title).order_by(Group.year, Group.title).all()
        admin_groups = OrderedDict()
        for year in Group.active_years():
            admin_groups[year] = [group for group in groups if group.year == year]

        settings = Setting.instance()

        data = {
            'COMPLEX_CHOICES': Task.COMPLEX_CHOICES,
            'current_year': settings.active_year,
            'site_disabled': settings.site_disabled,
            'admin_groups': admin_groups,
            'admin_disciplines': Discipline.query.all(),
        }
    data.update({
        'message': message,
    })
    return data
Пример #3
0
def inject_groups():
    groups = Group.active_groups().all()
    return {
        'menu_item_width': 100.0 / len(groups) if len(groups) else 100,
        'groups': groups
    }
Пример #4
0
def inject_groups():
    groups = Group.active_groups().all()
    return {
        'menu_item_width': 100 / len(groups) if len(groups) else 100,
        'groups': groups
    }