classifier.models¶
ClassifierAbstract¶
-
class
classifier.models.ClassifierAbstract(*args, **kwargs)[source]¶ Base class to create classifier models. Will provide base data and functions like validation and
to_python(convert from string to real type).In simplest case should be created model just inherited from this abstract model without extra code.
kind- custom identificator for classifier type (like: phone)value_type- expected type of value (like: string)value_validator- regex to validate extered value (like: +d{12})only_one_required- checkmark to make one on available lables requiredSupported types:
int,float,string,boolean,date,datatime.Labels with kind give posibility to create one type of record with different names, like kind is phone and available lables are “Mobile”, “Home”, “Work” etc.
-
kind¶ custom identificator for classifier type (like: phone)
-
value_type¶ expected type of value (like: string)
-
value_validator¶ regex to validate extered value (like: +d{12})
-
only_one_required¶ checkmark to make one on available lables required
-
ClassifierLabelAbstract¶
-
class
classifier.models.ClassifierLabelAbstract(*args, **kwargs)[source]¶ Base model class to define several human readable names for each classifier kind.
-
label¶ human redable label for data
-
required¶ checkmark to make label required
Returns: field related to model inherited from ClassifierAbstract. Raises: ClassifierModelNotFound – if related field wasn’t found Caution
not field name
-