web/views/autoform.py
branchstable
changeset 5463 37a2455639b9
parent 5426 0d4853a6e5ee
child 5464 c6c9a80ad1dd
equal deleted inserted replaced
5462:a37127c8bf23 5463:37a2455639b9
    23 
    23 
    24 Configuration through uicfg
    24 Configuration through uicfg
    25 ```````````````````````````
    25 ```````````````````````````
    26 
    26 
    27 It is possible to manage which and how an entity's attributes and relations
    27 It is possible to manage which and how an entity's attributes and relations
    28 will be edited in the various context where the automatic entity form is used
    28 will be edited in the various contexts where the automatic entity form is used
    29 by using proper uicfg tags.
    29 by using proper uicfg tags.
    30 
    30 
    31 The details of the uicfg syntax can be found in the :ref:`uicfg` chapter.
    31 The details of the uicfg syntax can be found in the :ref:`uicfg` chapter.
    32 
    32 
    33 Possible relation tags that apply to entity forms are detailled below.
    33 Possible relation tags that apply to entity forms are detailled below.
    51 * 'muledit', the table form when editing multiple entities of the same type
    51 * 'muledit', the table form when editing multiple entities of the same type
    52 
    52 
    53 
    53 
    54 section may be one of:
    54 section may be one of:
    55 
    55 
    56 * 'hidden', don't display (not even in an hidden input, right?)
    56 * 'hidden', don't display (not even in a hidden input)
    57 
    57 
    58 * 'attributes', display in the attributes section
    58 * 'attributes', display in the attributes section
    59 
    59 
    60 * 'relations', display in the relations section, using the generic relation
    60 * 'relations', display in the relations section, using the generic relation
    61   selector combobox (available in main form only, and not usable for attributes)
    61   selector combobox (available in main form only, and not usable for attributes)
   102    # Force usage of a TextInput widget for the expression attribute of
   102    # Force usage of a TextInput widget for the expression attribute of
   103    # RQLExpression entities
   103    # RQLExpression entities
   104    autoform_field_kwargs.tag_attribute(('RQLExpression', 'expression'),
   104    autoform_field_kwargs.tag_attribute(('RQLExpression', 'expression'),
   105                                        {'widget': fw.TextInput})
   105                                        {'widget': fw.TextInput})
   106 
   106 
   107 
   107 .. note::
       
   108 
       
   109    the widget argument can be either a class or an instance (the later
       
   110    case being convenient to pass the Widget specific initialisation
       
   111    options)
   108 
   112 
   109 Overriding permissions
   113 Overriding permissions
   110 ^^^^^^^^^^^^^^^^^^^^^^
   114 ^^^^^^^^^^^^^^^^^^^^^^
   111 
   115 
   112 The `autoform_permissions_overrides` rtag provides a way to by-pass security
   116 The `autoform_permissions_overrides` rtag provides a way to by-pass security
   619 
   623 
   620 
   624 
   621 # The automatic entity form ####################################################
   625 # The automatic entity form ####################################################
   622 
   626 
   623 class AutomaticEntityForm(forms.EntityFieldsForm):
   627 class AutomaticEntityForm(forms.EntityFieldsForm):
   624     """AutomaticEntityForm is an automagic form to edit any entity. It is
   628     """AutomaticEntityForm is an automagic form to edit any entity. It
   625     designed to be fully generated from schema but highly configurable through
   629     is designed to be fully generated from schema but highly
   626     :ref:`uicfg`.
   630     configurable through uicfg.
   627 
   631 
   628     Of course, as for other forms, you can also customise it by specifying
   632     Of course, as for other forms, you can also customise it by specifying
   629     various standard form parameters on selection, overriding, or
   633     various standard form parameters on selection, overriding, or
   630     adding/removing fields in a selected instances.
   634     adding/removing fields in selected instances.
   631     """
   635     """
   632     __regid__ = 'edition'
   636     __regid__ = 'edition'
   633 
   637 
   634     cwtarget = 'eformframe'
   638     cwtarget = 'eformframe'
   635     cssclass = 'entityForm'
   639     cssclass = 'entityForm'