From 43a90a237f8650737dd34e781fbf775b5bd18a8f Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Mon, 16 Jul 2018 13:33:25 +0200 Subject: [PATCH] Document the EnumField form field type --- calsocial/forms.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/calsocial/forms.py b/calsocial/forms.py index e7adf73..e066d7a 100644 --- a/calsocial/forms.py +++ b/calsocial/forms.py @@ -174,6 +174,16 @@ class TimezoneField(SelectField): class EnumField(SelectField): + """Field that allows selecting one value from an ``Enum`` class + + :param enum_type: an ``Enum`` type + :type enum_type: type(Enum) + :param translations: translatable labels for enum values + :type translations: dict + :param args: passed verbatim to the constructor of `SelectField` + :param kwargs: passed verbatim to the constructor of `SelectField` + """ + def __init__(self, enum_type, translations, *args, **kwargs): if not issubclass(enum_type, Enum): raise TypeError('enum_type must be a subclass of Enum') -- 2.45.2