equal
deleted
inserted
replaced
19 from cubicweb.view import View, EntityView |
19 from cubicweb.view import View, EntityView |
20 from cubicweb.web import INTERNAL_FIELD_VALUE, eid_param |
20 from cubicweb.web import INTERNAL_FIELD_VALUE, eid_param |
21 from cubicweb.web.controller import NAV_FORM_PARAMETERS |
21 from cubicweb.web.controller import NAV_FORM_PARAMETERS |
22 from cubicweb.web.widgets import checkbox, InputWidget, ComboBoxWidget |
22 from cubicweb.web.widgets import checkbox, InputWidget, ComboBoxWidget |
23 from cubicweb.web.form import FormMixIn |
23 from cubicweb.web.form import FormMixIn |
|
24 from cubicweb.web.views.editforms import AutomaticEntityForm |
24 |
25 |
25 _ = unicode |
26 _ = unicode |
26 |
27 |
27 |
28 |
28 class EditionForm(FormMixIn, EntityView): |
29 class EditionForm(FormMixIn, EntityView): |
324 return '\n'.join(result) |
325 return '\n'.join(result) |
325 |
326 |
326 # should_* method extracted to allow overriding |
327 # should_* method extracted to allow overriding |
327 |
328 |
328 def should_inline_relation_form(self, entity, rschema, targettype, role): |
329 def should_inline_relation_form(self, entity, rschema, targettype, role): |
329 return entity.rtags.is_inlined(rschema, targettype, role) |
330 return AutomaticForm.rinlined.etype_rtag(entity.id, role, rschema, targettype) |
330 |
331 |
331 def should_display_inline_relation_form(self, rschema, existant, card): |
332 def should_display_inline_relation_form(self, rschema, existant, card): |
332 return not existant and card in '1+' |
333 return not existant and card in '1+' |
333 |
334 |
334 def should_display_add_inline_relation_link(self, rschema, existant, card): |
335 def should_display_add_inline_relation_link(self, rschema, existant, card): |
426 super(InlineFormMixIn, self).edit_form(entity, kwargs) |
427 super(InlineFormMixIn, self).edit_form(entity, kwargs) |
427 |
428 |
428 def should_inline_relation_form(self, entity, rschema, targettype, role): |
429 def should_inline_relation_form(self, entity, rschema, targettype, role): |
429 if rschema == self.rschema: |
430 if rschema == self.rschema: |
430 return False |
431 return False |
431 return entity.rtags.is_inlined(rschema, targettype, role) |
432 return AutomaticForm.rinlined.etype_rtag(entity.id, role, rschema, targettype) |
432 |
433 |
433 @cached |
434 @cached |
434 def keep_entity(self, entity): |
435 def keep_entity(self, entity): |
435 req = self.req |
436 req = self.req |
436 # are we regenerating form because of a validation error ? |
437 # are we regenerating form because of a validation error ? |