# HG changeset patch # User Denis Laxalde # Date 1534946550 -7200 # Node ID cb05926a99d0e288277f9670d537ab15db06272d # Parent 34c7c656022f7cfe876d98853769a9a5a75fd63a [autoform] Use fieldclass from kwargs in guess_field for non-final relations This follows up on af969080e7e6 in which a "fieldclass" kwarg has been added in EntityFieldsForm.field_by_name() before calling guess_field(). In this changeset, this value was only used for final relation but the way non-final relation actually also changed since we also use guess_field from these relation (previously, the field class specified through uicfg was instantiated directly in EntityFieldsForm.field_by_name()). So in the non-final case in guess_field() we simply try to retrieve "fieldclass" from kwargs and fall back to RelationField. diff -r 34c7c656022f -r cb05926a99d0 cubicweb/web/formfields.py --- a/cubicweb/web/formfields.py Wed Jul 18 13:48:13 2018 +0200 +++ b/cubicweb/web/formfields.py Wed Aug 22 16:02:30 2018 +0200 @@ -1267,7 +1267,9 @@ if isinstance(cstr, SizeConstraint) and cstr.max is not None: kwargs['max_length'] = cstr.max return fieldclass(**kwargs) - return RelationField.fromcardinality(card, **kwargs) + else: + fieldclass = kwargs.pop('fieldclass', RelationField) + return fieldclass.fromcardinality(card, **kwargs) FIELDS = {