跳转到主要内容

基于formalchemy的pyramid视图组件

项目描述

rebecca.form

pyramid 基于的视图组件 FormAlchemy .

组件

  • FormView

  • AddFormView

  • EditFormView

  • DisplayView

示例

示例模型

class Item(Base):
    __tablename__ = 'items'
    id = sa.Column(sa.Integer, primary_key=True)
    name = sa.Column(sa.Unicode(255), nullable=False)
    value = sa.Column(sa.Integer, nullable=False)

    def __unicode__(self):
        return u"Item id={id}, name={name}, value={value}".format(id=self.id, name=self.name, value=self.value)

AddFormView

class AddItemView(AddFormView):
    __x_model__ = Item
    __x_session__ = DBSession

EditFormView

class EditItemView(EditFormView):
    __x_factory__ = item_finder

DisplayView

class DisplayItemView(DisplayView):
    __x_factory__ = item_finder

__x_factory__ 是可调用的,可以从请求中查找模型。

实用工具

MatchDictFinderRequest.matchdict 查询指定的模型。

例如,为

item_finder = MatchDictFinder(Item, DBSession, [(Item.id, 'item_id')])

item_finder 执行如下

DBSession.query(Item).filter(Item.id==request.matchdict['item_id']).one()

贡献者

  • Atsushi Odagiri,原始作者

变更日志

0.1

  • 首次发布

项目详情


下载文件

下载适用于您的平台文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。

源分发

rebecca.form-0.1.tar.gz (3.4 kB 查看散列)

上传时间

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面