Skip to main content

pyramid view components based on formalchemy

Project description

rebecca.form

pyramid view components based on FormAlchemy .

Components

  • FormView

  • AddFormView

  • EditFormView

  • DisplayView

Examples

Model for Example

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__ is callable to find model from request.

Utilities

MatchDictFinder queries for specified Model with conditions from Request.matchdict.

For example, create finder for

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

item_finder executes like this

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

Contributors

  • Atsushi Odagiri, original author

Changelog

0.1

  • first release

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rebecca.form-0.1.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file rebecca.form-0.1.tar.gz.

File metadata

  • Download URL: rebecca.form-0.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rebecca.form-0.1.tar.gz
Algorithm Hash digest
SHA256 7e29a8bffa4e2ecd165a017a16857642ba7f4af98ad6c8660b5fca9d8121610b
MD5 5a0348bb83f4412bc61f1fbc9e7253f5
BLAKE2b-256 6919c93e6182c31a0af51bcb4dd43b69273d67a6b500cb0d7d998d74d761f15c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page