web/views/editforms.py
branchtls-sprint
changeset 1762 1f7bb0cd950c
parent 1760 6b97d286eb5a
child 1763 65ec5ccc8927
equal deleted inserted replaced
1761:fef5d4b4f511 1762:1f7bb0cd950c
    92     onsubmit = ("return inlineValidateAttributeForm('%(divid)s-form', '%(rtype)s', "
    92     onsubmit = ("return inlineValidateAttributeForm('%(divid)s-form', '%(rtype)s', "
    93                 "'%(eid)s', '%(divid)s', %(reload)s);")
    93                 "'%(eid)s', '%(divid)s', %(reload)s);")
    94     ondblclick = "showInlineEditionForm(%(eid)s, '%(rtype)s', '%(divid)s')"
    94     ondblclick = "showInlineEditionForm(%(eid)s, '%(rtype)s', '%(divid)s')"
    95 
    95 
    96     def cell_call(self, row, col, rtype=None, role='subject', reload=False,
    96     def cell_call(self, row, col, rtype=None, role='subject', reload=False,
    97                   vid='textoutofcontext'):
    97                   vid='textoutofcontext', default=u''):
    98         """display field to edit entity's `rtype` relation on double-click"""
    98         """display field to edit entity's `rtype` relation on double-click"""
    99         rschema = self.schema.rschema(rtype)
    99         rschema = self.schema.rschema(rtype)
   100         entity = self.entity(row, col)
   100         entity = self.entity(row, col)
   101         if rschema.is_final():
   101         if rschema.is_final():
   102             if getattr(entity, rtype) is None:
   102             if getattr(entity, rtype) is None:
   103                 value = self.req._('not specified')
   103                 value = default or self.req._('not specified')
   104             else:
   104             else:
   105                 value = entity.printable_value(rtype)
   105                 value = entity.printable_value(rtype)
   106         else:
   106         else:
   107             rset = entity.related(rtype, role)
   107             rset = entity.related(rtype, role)
   108             value = self.view(vid, rset, 'null')
   108             value = self.view(vid, rset, 'null') or default
   109         if not entity.has_perm('update'):
   109         if not entity.has_perm('update'):
   110             self.w(value)
   110             self.w(value)
   111             return
   111             return
   112         if rschema.is_final():
   112         if rschema.is_final():
   113             form = self._build_attribute_form(entity, value, rtype, role, reload, row, col)
   113             form = self._build_attribute_form(entity, value, rtype, role, reload, row, col)