doc/book/en/devweb/views/reledit.rst
changeset 8665 e65af61bde7d
parent 7760 75d80ef524c7
child 10222 75d6096216d7
equal deleted inserted replaced
8664:29652410c317 8665:e65af61bde7d
    66 The `reledit_ctrl` rtag
    66 The `reledit_ctrl` rtag
    67 ***********************
    67 ***********************
    68 
    68 
    69 The behaviour of reledited attributes/relations can be finely
    69 The behaviour of reledited attributes/relations can be finely
    70 controlled using the reledit_ctrl rtag, defined in
    70 controlled using the reledit_ctrl rtag, defined in
    71 :mod:`cubicweb.web.uicfg`.
    71 :mod:`cubicweb.web.views.uicfg`.
    72 
    72 
    73 This rtag provides four control variables:
    73 This rtag provides four control variables:
    74 
    74 
    75 * ``default_value``: alternative default value
    75 * ``default_value``: alternative default value
    76    The default value is what is shown when there is no value.
    76    The default value is what is shown when there is no value.
    91 Let's see how to use these controls.
    91 Let's see how to use these controls.
    92 
    92 
    93 .. sourcecode:: python
    93 .. sourcecode:: python
    94 
    94 
    95     from logilab.mtconverter import xml_escape
    95     from logilab.mtconverter import xml_escape
    96     from cubicweb.web.uicfg import reledit_ctrl
    96     from cubicweb.web.views.uicfg import reledit_ctrl
    97     reledit_ctrl.tag_attribute(('Company', 'name'),
    97     reledit_ctrl.tag_attribute(('Company', 'name'),
    98                                {'reload': lambda x:x.eid,
    98                                {'reload': lambda x:x.eid,
    99                                 'default_value': xml_escape(u'<logilab tastes better>')})
    99                                 'default_value': xml_escape(u'<logilab tastes better>')})
   100     reledit_ctrl.tag_object_of(('*', 'boss', 'Person'), {'edit_target': 'related'})
   100     reledit_ctrl.tag_object_of(('*', 'boss', 'Person'), {'edit_target': 'related'})
   101 
   101 
   123 the 'attribute' section of the default primary view.  If you want to disable
   123 the 'attribute' section of the default primary view.  If you want to disable
   124 it for some attribute or relation, you have use `uicfg`:
   124 it for some attribute or relation, you have use `uicfg`:
   125 
   125 
   126 .. sourcecode:: python
   126 .. sourcecode:: python
   127 
   127 
   128     import uicfg.primaryview_display_ctrl as _pvdc
   128     from cubicweb.web.views.uicfg import primaryview_display_ctrl as _pvdc
   129     _pvdc.tag_attribute(('Company', 'name'), {'vid': 'incontext'})
   129     _pvdc.tag_attribute(('Company', 'name'), {'vid': 'incontext'})
   130 
   130 
   131 To deactivate it everywhere it's used automatically, you may use the code snippet
   131 To deactivate it everywhere it's used automatically, you may use the code snippet
   132 below somewhere in your cube's views:
   132 below somewhere in your cube's views:
   133 
   133