# HG changeset patch # User Sylvain Thénault # Date 1253555361 -7200 # Node ID 9ca73fbd3a58403412bc3ef596ae01d6604c952d # Parent 39ea15e4589a38af4bc7cfb5f5bb5d1f2f543456 refactor to ease overriding diff -r 39ea15e4589a -r 9ca73fbd3a58 web/views/autoform.py --- a/web/views/autoform.py Mon Sep 21 19:49:02 2009 +0200 +++ b/web/views/autoform.py Mon Sep 21 19:49:21 2009 +0200 @@ -302,6 +302,13 @@ """ return not existant and card in '1+' or self.req.form.has_key('force_%s_display' % rschema) + def display_inline_creation_form(self, w, rschema, targettype, role, + i18nctx): + entity = self.edited_entity + w(self.view('inline-creation', None, etype=targettype, + peid=entity.eid, ptype=entity.e_schema, + rtype=rschema, role=role, i18nctx=i18nctx)) + def should_display_add_new_relation_link(self, rschema, existant, card): """return true if we should add a link to add a new creation form (through ajax call) diff -r 39ea15e4589a -r 9ca73fbd3a58 web/views/formrenderers.py --- a/web/views/formrenderers.py Mon Sep 21 19:49:02 2009 +0200 +++ b/web/views/formrenderers.py Mon Sep 21 19:49:21 2009 +0200 @@ -508,9 +508,8 @@ # there is no related entity and we need at least one: we need to # display one explicit inline-creation view if form.should_display_inline_creation_form(rschema, existant, card): - w(form.view('inline-creation', None, etype=targettype, - peid=entity.eid, ptype=entity.e_schema, - rtype=rschema, role=role, i18nctx=i18nctx)) + form.display_inline_creation_form(w, rschema, targettype, + role, i18nctx) existant = True # we can create more than one related entity, we thus display a link # to add new related entities @@ -529,7 +528,6 @@ w(u'') - class EntityInlinedFormRenderer(EntityFormRenderer): """specific renderer for entity inlined edition form (inline-[creation|edition])