GithubHelp home page GithubHelp logo

zeam-form-composed's Introduction

==================
zeam.form.composed
==================

This package let you defines forms containing other forms in
`zeam.form.base`_.

.. contents::

Example
=======

Here a simple example. Let's define a setting form::

  from zeam.form import composed, base
  from zope.interface import Interface


  class Setting(composed.ComposedForm):
      composed.context(Interface)

      label = u"Settings"


After, a module can add some mail settings on that screen::

  class MailSetting(composed.SubForm):
      composed.context(MyApplication)
      composed.view(Setting)
      composed.order(99)

      label = u"Mail delivery settings"
      ...

And publications of that application could add some publication
settings::

  class PublicationSetting(composed.SubForm):
      composed.context(MyPublications)
      composed.view(Setting)
      composed.order(10)

      label = u"Publication settings"
      ...


Some default templates are included as well, but you can replace like
you will do in `zeam.form.base`_.

API
===

Classes
-------

``ComposedForm``
    This class define a form which able to contain other forms. It
    behave like a ``zeam.form.base`` Form, but does use its fields.
    A usefull method can give you back a given subform :
    ``getSubForm(identifier)``.

``SubForm``
    This class represent a form which is contained inside a
    ``ComposedForm``. This form behave exactly like a
    ``zeam.form.base`` Form to which you add:

    - a method ``available()`` which is called before anything else to
      know if the form shoud still be included in the ``ComposedForm``.

    - a method ``getComposedForm()`` that gives you back the composed
      form in which this form is rendered.

``SubFormGroup``
    This class let you group ``SubForm`` together. They are rendered within
    the group template, and prefixed by the group name. Like a ``SubForm``
    they have an ``available()`` and a ``getComposedForm()`` method. It as
    well have a ``getSubForm(identifier)`` method.

Directives
----------

All those directives comes from Grokcore component. Please refer to
the `Grok documentation <http://grok.zope.org>`_ for more information.

``context``
    Define for which object the form/sub form is available.

``layer``
    Define the skin for which the form/sub form is aviable.

``require``
    Define a permission need to access the form.

``template``
    Define a Grok-like template for the form. After you done that, the
    Grok template will be look up and used. You can't use anymore a
    ``megrok.pagetemplate`` template, unless you set ``template=None``
    again on your form class.

``view``
    On a sub form, define for which form the sub form is available.

``order``
    Let you specify a number to sort your sub form afterwards using
    that setting.

.. _zeam.form.base: http://pypi.python.org/pypi/zeam.form.base

zeam-form-composed's People

Contributors

goschtl avatar gwik avatar thefunny42 avatar trollfot avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.