Form

Base class: Part

Describe a Form. Example:

class MyForm(Form):
    a = Field()
    b = Field.email()

form = MyForm().bind(request=request)

You can also create an instance of a form with this syntax if it’s more convenient:

form = MyForm(
    fields=dict(
        a=Field(),
        b=Field.email(),
    ]
).bind(request=request)

See tri.declarative docs for more on this dual style of declaration.

Refinable members

  • action_class
  • actions
    Type: Namespace
  • actions_template
  • after
  • attrs
    Type: Attrs
  • editable
    Type: bool
  • endpoints
    Type: Namespace
  • extra
  • extra_evaluated
  • h_tag
  • include
    Type: bool
  • iommi_style
    Type: str
  • member_class
  • model
  • page_class
  • post_validation
  • template
  • title

Defaults

  • actions__submit__call_target__attribute
    • submit
  • attrs__action
    • ""
  • attrs__enctype
    • multipart/form-data
  • attrs__method
    • post
  • editable
    • True
  • h_tag__call_target
    • iommi.fragment.Header

Shortcuts

create

Defaults

  • call_target__attribute
    • crud
  • extra__is_create
    • True
  • actions__submit__post_handler
    • iommi.form.create_object__post_handler
  • auto__type
    • create

crud

Defaults

  • extra__on_save
    • lambda **kwargs: None, # pragma: no mutate
  • extra__redirect
    • lambda redirect_to, **_: HttpResponseRedirect(redirect_to)
  • extra__redirect_to
    • None
  • auto
    • Namespace()

delete

Defaults

  • call_target__attribute
    • crud
  • actions__submit__call_target__attribute
    • delete
  • actions__submit__post_handler
    • iommi.form.delete_object__post_handler
  • auto__type
    • delete
  • editable
    • False

edit

Defaults

  • call_target__attribute
    • crud
  • extra__is_create
    • False
  • actions__submit__post_handler
    • iommi.form.edit_object__post_handler
  • auto__type
    • edit