|
OpenQuizz
Une application de gestion des contenus pédagogiques
|


Public Member Functions | |
| def | __init__ (self, typing.Iterable choices, typing.Optional[typing.Iterable[str]] labels=None, *typing.Optional[str] error=None) |
| typing.Any | __call__ (self, typing.Any value) |
| typing.Iterable[typing.Tuple[typing.Any, str]] | options (self, typing.Union[str, typing.Callable[[typing.Any], typing.Any]] valuegetter=str) |
Public Member Functions inherited from Validator | |
| str | __repr__ (self) |
Data Fields | |
| choices | |
| choices_text | |
| labels | |
| labels_text | |
| error | |
Static Public Attributes | |
| default_message | |
Static Public Attributes inherited from Validator | |
| error | |
Validator which succeeds if ``value`` is a member of ``choices``.
:param choices: A sequence of valid values.
:param labels: Optional sequence of labels to pair with the choices.
:param error: Error message to raise in case of a validation error. Can be
interpolated with `{input}`, `{choices}` and `{labels}`.
| def __init__ | ( | self, | |
| typing.Iterable | choices, | ||
| typing.Optional[typing.Iterable[str]] | labels = None, |
||
| *typing.Optional[str] | error = None |
||
| ) |
| typing.Any __call__ | ( | self, | |
| typing.Any | value | ||
| ) |
Reimplemented from Validator.
| typing.Iterable[typing.Tuple[typing.Any, str]] options | ( | self, | |
| typing.Union[str, typing.Callable[[typing.Any], typing.Any]] | valuegetter = str |
||
| ) |
Return a generator over the (value, label) pairs, where value
is a string associated with each choice. This convenience method
is useful to populate, for instance, a form select field.
:param valuegetter: Can be a callable or a string. In the former case, it must
be a one-argument callable which returns the value of a
choice. In the latter case, the string specifies the name
of an attribute of the choice objects. Defaults to `str()`
or `str()`.
| choices |
| choices_text |
|
static |
| error |
| labels |
| labels_text |