:mod:`zemfrog.helper` ===================== .. py:module:: zemfrog.helper Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: zemfrog.helper.get_template zemfrog.helper.copy_template zemfrog.helper.import_attr zemfrog.helper.search_model zemfrog.helper.get_models zemfrog.helper.db_add zemfrog.helper.db_delete zemfrog.helper.db_update zemfrog.helper.db_commit zemfrog.helper.get_mail_template zemfrog.helper.get_import_name zemfrog.helper.get_user_roles zemfrog.helper.get_column_names zemfrog.helper.get_object_model .. data:: TEMPLATE_DIR .. function:: get_template(*paths) -> str Function to get template base directory. :param paths: template directory or file name. :raises: ZemfrogTemplateNotFound .. function:: copy_template(name: str, dst: str) Function for copying templates. :param name: template directory name. :param dst: Destination output. .. function:: import_attr(module: str) Functions to get attributes in modules. :param module: e.g. os.path .. function:: search_model(name: str) -> str Function for getting the model location. :param name: model name. :raises: ZemfrogModelNotFound .. function:: get_models(mod: types.ModuleType) -> list Function to get all ORM models in the module. :param mod: module object. .. function:: db_add(model) Functions for adding data to the database. .. function:: db_delete(model) Functions to delete data in the database. .. function:: db_update(model, **kwds) Function to update data in database. .. function:: db_commit() Functions for saving data to a database. .. function:: get_mail_template(name, **context) Functions to get email templates. :param name: email template name. :param \*\*context: jinja context. .. function:: get_import_name(app: flask.Flask) -> str .. function:: get_user_roles(user) .. function:: get_column_names(model) Reference: * https://stackoverflow.com/questions/32927071/get-column-names-dynamically-with-sqlalchemy/33033067 .. function:: get_object_model(name)