/
Ao
/
MaxReport
Обзор
Документация
Войти
/
Ao
/
MaxReport
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
pgsql/pgAdmin 4/python/Lib/site-packages/flask_sqlalchemy/cli.py
16 строк
484 B
AoAnima
first_commit
13 июл 2026, 17:47
13 июл 2026, 17:47
f1a670a
Код
Авторство
О чём код?
from __future__ import annotations import typing as t from flask import current_app def add_models_to_shell() -> dict[str, t.Any]: """Registered with :meth:`~flask.Flask.shell_context_processor` if ``add_models_to_shell`` is enabled. Adds the ``db`` instance and all model classes to ``flask shell``. """ db = current_app.extensions["sqlalchemy"] out = {m.class_.__name__: m.class_ for m in db.Model._sa_registry.mappers} out["db"] = db return out