Skip to main content

zeam.form.autofields is able to collect fields definition for your form. This enable you to create forms with a plugable list of fields.

Example

You need first to define a group of fields. This will be just an interface:

>>> from zope.interface import Interface

>>> class IReplyFields(Interface):
...    pass

Now you can define groups of fields:

>>> from zeam.form import base, autofields

>>> class ReplyInformation(autofields.AutoFields):
...     autofields.group(IReplyFields)
...     autofields.order(0)
...     fields = base.Fields(base.Field('Comment'))

>>> class ReplyBlogInformation(autofields.AutoFields):
...     autofields.group(IReplyFields)
...     autofields.order(10)
...     fields = base.Fields(base.Field('Blog URL'))

And you will be able to use those fields on your form somewhere else:

>>> class ReplyForm(base.Form):
...     fields = autofields.FieldsCollector(IReplyFields)

API

In addition to its API, zeam.form.autofields export the one of zeam.form.base.

Classes

AutoFields

Base classes used to define a group of Fields to be included in a form.

Directives

group

Directive used on AutoFields which select for which group you whish to provide the fields for. A group is just a plain zope interface, that will be given as parameter to the FieldsCollector.

view

Directive used on AutoFields that will let you specify for which Form (or view) you whish to provide the fields for. This directive is not required, and default to IBrowserView.

order

Optional directive which let decide in wich order the fields will included at the end.

Properties

FieldsCollector

Property used to collect form Fields for you.

Changelog

1.0 (2011/11/08)

  • Initial release

Download files

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

Source Distribution

zeam.form.autofields-1.0.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file zeam.form.autofields-1.0.tar.gz.

File metadata

File hashes

Hashes for zeam.form.autofields-1.0.tar.gz
Algorithm Hash digest
SHA256 e8e02241b8182f6d3bfbecb0ce1e3922cecc42997781f0468d172d498e373569
MD5 4d010bfdfabfc9f30783370b63f68129
BLAKE2b-256 c85be9919fc35c9fcb375a9ee35a49bd7611f06fe6ef6eac800ae120914d95ab

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.1

1 file

This release

1.0 This release

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page