本文整理汇总了Python中flask.ext.sqlalchemy.SQLAlchemy方法的典型用法代码示例。如果您正苦于以下问题:Python sqlalchemy.SQLAlchemy方法的具体用法?Python sqlalchemy.SQLAlchemy怎么用?Python sqlalchemy.SQLAlchemy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flask.ext.sqlalchemy
的用法示例。
在下文中一共展示了sqlalchemy.SQLAlchemy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: url_for
# 需要导入模块: from flask.ext import sqlalchemy [as 别名]
# 或者: from flask.ext.sqlalchemy import SQLAlchemy [as 别名]
def url_for(self, model, **kw):
"""Returns the URL for the specified model, similar to
:func:`flask.url_for`.
`model` is a SQLAlchemy model class. This must be a model on which
:meth:`create_api_blueprint` has been invoked previously.
This method only returns URLs for endpoints created by this
:class:`APIManager`.
The remaining keyword arguments are passed directly on to
:func:`flask.url_for`.
"""
collection_name = self.collection_name(model)
api_name = APIManager.api_name(collection_name)
blueprint_name = self.blueprint_name(model)
joined = '.'.join([blueprint_name, api_name])
return flask.url_for(joined, **kw)
示例2: collection_name
# 需要导入模块: from flask.ext import sqlalchemy [as 别名]
# 或者: from flask.ext.sqlalchemy import SQLAlchemy [as 别名]
def collection_name(self, model):
"""Returns the name by which the user told us to call collections of
instances of this model.
`model` is a SQLAlchemy model class. This must be a model on which
:meth:`create_api_blueprint` has been invoked previously.
"""
return self.created_apis_for[model].collection_name
示例3: blueprint_name
# 需要导入模块: from flask.ext import sqlalchemy [as 别名]
# 或者: from flask.ext.sqlalchemy import SQLAlchemy [as 别名]
def blueprint_name(self, model):
"""Returns the name of the blueprint in which an API was created for
the specified model.
`model` is a SQLAlchemy model class. This must be a model on which
:meth:`create_api_blueprint` has been invoked previously.
"""
return self.created_apis_for[model].blueprint_name