# HG changeset patch # User Denis Laxalde # Date 1534946679 -7200 # Node ID 6bcdd7278f7f7ef9e5332224e32497bdabec9df9 # Parent cb05926a99d0e288277f9670d537ab15db06272d [autoform] Make RelationField.fromcardinality a class method factory Instead of having the "RelationField" class hard-coded in this factory method (thus preventing any subclass to properly use it), we make that method a classmethod and instantiate the actual class instead of the base one. diff -r cb05926a99d0 -r 6bcdd7278f7f cubicweb/web/formfields.py --- a/cubicweb/web/formfields.py Wed Aug 22 16:02:30 2018 +0200 +++ b/cubicweb/web/formfields.py Wed Aug 22 16:04:39 2018 +0200 @@ -1074,10 +1074,10 @@ :class:`~cubicweb.web.formwidgets.Select`. """ - @staticmethod - def fromcardinality(card, **kwargs): + @classmethod + def fromcardinality(cls, card, **kwargs): kwargs.setdefault('widget', fw.Select(multiple=card in '*+')) - return RelationField(**kwargs) + return cls(**kwargs) def choices(self, form, limit=None): """Take care, choices function for relation field instance should take