本文整理匯總了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