equal
deleted
inserted
replaced
1072 |
1072 |
1073 Unless explicitly specified, the widget for this field will be a |
1073 Unless explicitly specified, the widget for this field will be a |
1074 :class:`~cubicweb.web.formwidgets.Select`. |
1074 :class:`~cubicweb.web.formwidgets.Select`. |
1075 """ |
1075 """ |
1076 |
1076 |
1077 @staticmethod |
1077 @classmethod |
1078 def fromcardinality(card, **kwargs): |
1078 def fromcardinality(cls, card, **kwargs): |
1079 kwargs.setdefault('widget', fw.Select(multiple=card in '*+')) |
1079 kwargs.setdefault('widget', fw.Select(multiple=card in '*+')) |
1080 return RelationField(**kwargs) |
1080 return cls(**kwargs) |
1081 |
1081 |
1082 def choices(self, form, limit=None): |
1082 def choices(self, form, limit=None): |
1083 """Take care, choices function for relation field instance should take |
1083 """Take care, choices function for relation field instance should take |
1084 an extra 'limit' argument, with default to None. |
1084 an extra 'limit' argument, with default to None. |
1085 |
1085 |