ramifice 0.8.11__py3-none-any.whl → 0.8.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ramifice/__init__.py +16 -1
- ramifice/commons/__init__.py +2 -2
- ramifice/commons/general.py +11 -11
- ramifice/commons/indexes.py +8 -8
- ramifice/commons/many.py +10 -6
- ramifice/commons/one.py +13 -8
- ramifice/commons/tools.py +4 -4
- ramifice/commons/unit_manager.py +15 -5
- ramifice/fields/__init__.py +1 -1
- ramifice/fields/bool_field.py +26 -18
- ramifice/fields/choice_float_dyn_field.py +29 -21
- ramifice/fields/choice_float_field.py +41 -33
- ramifice/fields/choice_float_mult_dyn_field.py +29 -21
- ramifice/fields/choice_float_mult_field.py +48 -40
- ramifice/fields/choice_int_dyn_field.py +29 -21
- ramifice/fields/choice_int_field.py +41 -33
- ramifice/fields/choice_int_mult_dyn_field.py +29 -21
- ramifice/fields/choice_int_mult_field.py +48 -40
- ramifice/fields/choice_text_dyn_field.py +29 -21
- ramifice/fields/choice_text_field.py +47 -39
- ramifice/fields/choice_text_mult_dyn_field.py +29 -21
- ramifice/fields/choice_text_mult_field.py +48 -40
- ramifice/fields/color_field.py +40 -32
- ramifice/fields/date_field.py +49 -40
- ramifice/fields/date_time_field.py +49 -40
- ramifice/fields/email_field.py +42 -34
- ramifice/fields/file_field.py +45 -35
- ramifice/fields/float_field.py +56 -47
- ramifice/fields/general/__init__.py +1 -1
- ramifice/fields/general/choice_group.py +2 -2
- ramifice/fields/general/date_group.py +2 -2
- ramifice/fields/general/field.py +2 -2
- ramifice/fields/general/file_group.py +2 -2
- ramifice/fields/general/number_group.py +2 -2
- ramifice/fields/general/text_group.py +3 -3
- ramifice/fields/id_field.py +35 -28
- ramifice/fields/image_field.py +67 -57
- ramifice/fields/integer_field.py +56 -47
- ramifice/fields/ip_field.py +41 -34
- ramifice/fields/password_field.py +29 -22
- ramifice/fields/phone_field.py +44 -36
- ramifice/fields/slug_field.py +30 -22
- ramifice/fields/text_field.py +43 -35
- ramifice/fields/url_field.py +40 -33
- ramifice/models/__init__.py +1 -1
- ramifice/models/decorator.py +33 -11
- ramifice/models/model.py +16 -16
- ramifice/paladins/__init__.py +2 -2
- ramifice/paladins/check.py +8 -3
- ramifice/paladins/delete.py +9 -3
- ramifice/paladins/groups/__init__.py +1 -1
- ramifice/paladins/groups/bool_group.py +3 -3
- ramifice/paladins/groups/choice_group.py +3 -3
- ramifice/paladins/groups/date_group.py +3 -3
- ramifice/paladins/groups/file_group.py +3 -3
- ramifice/paladins/groups/id_group.py +3 -3
- ramifice/paladins/groups/img_group.py +3 -3
- ramifice/paladins/groups/num_group.py +3 -3
- ramifice/paladins/groups/pass_group.py +3 -3
- ramifice/paladins/groups/slug_group.py +8 -3
- ramifice/paladins/groups/text_group.py +3 -3
- ramifice/paladins/password.py +11 -4
- ramifice/paladins/refrash.py +7 -3
- ramifice/paladins/save.py +9 -3
- ramifice/paladins/tools.py +11 -6
- ramifice/paladins/validation.py +4 -4
- ramifice/utils/__init__.py +1 -1
- ramifice/utils/constants.py +1 -1
- ramifice/utils/errors.py +7 -7
- ramifice/utils/fixtures.py +7 -2
- ramifice/utils/migration.py +18 -9
- ramifice/utils/mixins/__init__.py +1 -1
- ramifice/utils/mixins/add_valid.py +3 -3
- ramifice/utils/mixins/hooks.py +8 -8
- ramifice/utils/mixins/indexing.py +3 -3
- ramifice/utils/mixins/json_converter.py +6 -6
- ramifice/utils/tools.py +12 -12
- ramifice/utils/translations.py +24 -8
- ramifice/utils/unit.py +8 -3
- {ramifice-0.8.11.dist-info → ramifice-0.8.13.dist-info}/METADATA +9 -5
- ramifice-0.8.13.dist-info/RECORD +84 -0
- ramifice-0.8.11.dist-info/RECORD +0 -84
- {ramifice-0.8.11.dist-info → ramifice-0.8.13.dist-info}/WHEEL +0 -0
- {ramifice-0.8.11.dist-info → ramifice-0.8.13.dist-info}/licenses/LICENSE +0 -0
@@ -1,18 +1,22 @@
|
|
1
|
-
"""Field of Model.
|
1
|
+
"""Ramifice - Field of Model.
|
2
2
|
|
3
3
|
Type of selective float field with static of elements.
|
4
4
|
"""
|
5
5
|
|
6
6
|
__all__ = ("ChoiceFloatField",)
|
7
7
|
|
8
|
+
import logging
|
9
|
+
|
8
10
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
9
11
|
from ramifice.fields.general.field import Field
|
10
12
|
from ramifice.utils import constants
|
11
13
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
12
14
|
|
15
|
+
logger = logging.getLogger(__name__)
|
16
|
+
|
13
17
|
|
14
18
|
class ChoiceFloatField(Field, ChoiceGroup, JsonMixin):
|
15
|
-
"""Field of Model.
|
19
|
+
"""Ramifice - Field of Model.
|
16
20
|
|
17
21
|
Type of selective integer float with static of elements.
|
18
22
|
With a single choice.
|
@@ -54,41 +58,45 @@ class ChoiceFloatField(Field, ChoiceGroup, JsonMixin):
|
|
54
58
|
self.choices = choices
|
55
59
|
|
56
60
|
if constants.DEBUG:
|
57
|
-
|
58
|
-
if not
|
59
|
-
|
60
|
-
|
61
|
+
try:
|
62
|
+
if choices is not None:
|
63
|
+
if not isinstance(choices, list):
|
64
|
+
raise AssertionError("Parameter `choices` - Not а `list` type!")
|
65
|
+
if len(choices) == 0:
|
66
|
+
raise AssertionError(
|
67
|
+
"The `choices` parameter should not contain an empty list!"
|
68
|
+
)
|
69
|
+
if default is not None and not isinstance(default, float):
|
70
|
+
raise AssertionError("Parameter `default` - Not а `float` type!")
|
71
|
+
if default is not None and choices is not None and not self.has_value():
|
61
72
|
raise AssertionError(
|
62
|
-
"
|
73
|
+
"Parameter `default` does not coincide with "
|
74
|
+
+ "list of permissive values in `choicees`."
|
63
75
|
)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
)
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
raise
|
85
|
-
if not isinstance(required, bool):
|
86
|
-
raise AssertionError("Parameter `required` - Not а `bool` type!")
|
87
|
-
if not isinstance(readonly, bool):
|
88
|
-
raise AssertionError("Parameter `readonly` - Not а `bool` type!")
|
76
|
+
if not isinstance(label, str):
|
77
|
+
raise AssertionError("Parameter `default` - Not а `str` type!")
|
78
|
+
if not isinstance(disabled, bool):
|
79
|
+
raise AssertionError("Parameter `disabled` - Not а `bool` type!")
|
80
|
+
if not isinstance(hide, bool):
|
81
|
+
raise AssertionError("Parameter `hide` - Not а `bool` type!")
|
82
|
+
if not isinstance(ignored, bool):
|
83
|
+
raise AssertionError("Parameter `ignored` - Not а `bool` type!")
|
84
|
+
if not isinstance(ignored, bool):
|
85
|
+
raise AssertionError("Parameter `ignored` - Not а `bool` type!")
|
86
|
+
if not isinstance(hint, str):
|
87
|
+
raise AssertionError("Parameter `hint` - Not а `str` type!")
|
88
|
+
if warning is not None and not isinstance(warning, list):
|
89
|
+
raise AssertionError("Parameter `warning` - Not а `list` type!")
|
90
|
+
if not isinstance(required, bool):
|
91
|
+
raise AssertionError("Parameter `required` - Not а `bool` type!")
|
92
|
+
if not isinstance(readonly, bool):
|
93
|
+
raise AssertionError("Parameter `readonly` - Not а `bool` type!")
|
94
|
+
except AssertionError as err:
|
95
|
+
logger.error(str(err))
|
96
|
+
raise err
|
89
97
|
|
90
98
|
def has_value(self, is_migrate: bool = False) -> bool:
|
91
|
-
"""Does the field value match the possible options in choices."""
|
99
|
+
"""Ramifice - Does the field value match the possible options in choices."""
|
92
100
|
value = self.value
|
93
101
|
if value is None:
|
94
102
|
value = self.default
|
@@ -1,18 +1,22 @@
|
|
1
|
-
"""Field of Model.
|
1
|
+
"""Ramifice - Field of Model.
|
2
2
|
|
3
3
|
Type of selective float field with dynamic addition of elements.
|
4
4
|
"""
|
5
5
|
|
6
6
|
__all__ = ("ChoiceFloatMultDynField",)
|
7
7
|
|
8
|
+
import logging
|
9
|
+
|
8
10
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
9
11
|
from ramifice.fields.general.field import Field
|
10
12
|
from ramifice.utils import constants
|
11
13
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
12
14
|
|
15
|
+
logger = logging.getLogger(__name__)
|
16
|
+
|
13
17
|
|
14
18
|
class ChoiceFloatMultDynField(Field, ChoiceGroup, JsonMixin):
|
15
|
-
"""Field of Model.
|
19
|
+
"""Ramifice - Field of Model.
|
16
20
|
|
17
21
|
Type of selective float field with dynamic addition of elements.
|
18
22
|
For simulate relationship Many-to-Many.
|
@@ -30,24 +34,28 @@ class ChoiceFloatMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
30
34
|
readonly: bool = False,
|
31
35
|
):
|
32
36
|
if constants.DEBUG:
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
37
|
+
try:
|
38
|
+
if not isinstance(label, str):
|
39
|
+
raise AssertionError("Parameter `default` - Not а `str` type!")
|
40
|
+
if not isinstance(disabled, bool):
|
41
|
+
raise AssertionError("Parameter `disabled` - Not а `bool` type!")
|
42
|
+
if not isinstance(hide, bool):
|
43
|
+
raise AssertionError("Parameter `hide` - Not а `bool` type!")
|
44
|
+
if not isinstance(ignored, bool):
|
45
|
+
raise AssertionError("Parameter `ignored` - Not а `bool` type!")
|
46
|
+
if not isinstance(ignored, bool):
|
47
|
+
raise AssertionError("Parameter `ignored` - Not а `bool` type!")
|
48
|
+
if not isinstance(hint, str):
|
49
|
+
raise AssertionError("Parameter `hint` - Not а `str` type!")
|
50
|
+
if warning is not None and not isinstance(warning, list):
|
51
|
+
raise AssertionError("Parameter `warning` - Not а `list` type!")
|
52
|
+
if not isinstance(required, bool):
|
53
|
+
raise AssertionError("Parameter `required` - Not а `bool` type!")
|
54
|
+
if not isinstance(readonly, bool):
|
55
|
+
raise AssertionError("Parameter `readonly` - Not а `bool` type!")
|
56
|
+
except AssertionError as err:
|
57
|
+
logger.error(str(err))
|
58
|
+
raise err
|
51
59
|
|
52
60
|
Field.__init__(
|
53
61
|
self,
|
@@ -72,7 +80,7 @@ class ChoiceFloatMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
72
80
|
self.choices: list[list[float | str]] | None = None
|
73
81
|
|
74
82
|
def has_value(self, is_migrate: bool = False) -> bool:
|
75
|
-
"""Does the field value match the possible options in choices."""
|
83
|
+
"""Ramifice - Does the field value match the possible options in choices."""
|
76
84
|
if is_migrate:
|
77
85
|
return True
|
78
86
|
value = self.value
|
@@ -1,18 +1,22 @@
|
|
1
|
-
"""Field of Model.
|
1
|
+
"""Ramifice - Field of Model.
|
2
2
|
|
3
3
|
Type of selective float field with static of elements.
|
4
4
|
"""
|
5
5
|
|
6
6
|
__all__ = ("ChoiceFloatMultField",)
|
7
7
|
|
8
|
+
import logging
|
9
|
+
|
8
10
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
9
11
|
from ramifice.fields.general.field import Field
|
10
12
|
from ramifice.utils import constants
|
11
13
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
12
14
|
|
15
|
+
logger = logging.getLogger(__name__)
|
16
|
+
|
13
17
|
|
14
18
|
class ChoiceFloatMultField(Field, ChoiceGroup, JsonMixin):
|
15
|
-
"""Field of Model.
|
19
|
+
"""Ramifice - Field of Model.
|
16
20
|
|
17
21
|
Type of selective float field with static of elements.
|
18
22
|
With multiple choice.
|
@@ -55,46 +59,50 @@ class ChoiceFloatMultField(Field, ChoiceGroup, JsonMixin):
|
|
55
59
|
self.choices = choices
|
56
60
|
|
57
61
|
if constants.DEBUG:
|
58
|
-
|
59
|
-
if not
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
if not
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
62
|
+
try:
|
63
|
+
if choices is not None:
|
64
|
+
if not isinstance(choices, list):
|
65
|
+
raise AssertionError("Parameter `choices` - Not а `list` type!")
|
66
|
+
if len(choices) == 0:
|
67
|
+
raise AssertionError(
|
68
|
+
"The `choices` parameter should not contain an empty list!"
|
69
|
+
)
|
70
|
+
if default is not None:
|
71
|
+
if not isinstance(default, list):
|
72
|
+
raise AssertionError("Parameter `default` - Not а `list` type!")
|
73
|
+
if len(default) == 0:
|
74
|
+
raise AssertionError(
|
75
|
+
"The `default` parameter should not contain an empty list!"
|
76
|
+
)
|
77
|
+
if choices is not None and not self.has_value():
|
78
|
+
raise AssertionError(
|
79
|
+
"Parameter `default` does not coincide with "
|
80
|
+
+ "list of permissive values in `choicees`."
|
81
|
+
)
|
82
|
+
if not isinstance(label, str):
|
83
|
+
raise AssertionError("Parameter `default` - Not а `str` type!")
|
84
|
+
if not isinstance(disabled, bool):
|
85
|
+
raise AssertionError("Parameter `disabled` - Not а `bool` type!")
|
86
|
+
if not isinstance(hide, bool):
|
87
|
+
raise AssertionError("Parameter `hide` - Not а `bool` type!")
|
88
|
+
if not isinstance(ignored, bool):
|
89
|
+
raise AssertionError("Parameter `ignored` - Not а `bool` type!")
|
90
|
+
if not isinstance(ignored, bool):
|
91
|
+
raise AssertionError("Parameter `ignored` - Not а `bool` type!")
|
92
|
+
if not isinstance(hint, str):
|
93
|
+
raise AssertionError("Parameter `hint` - Not а `str` type!")
|
94
|
+
if warning is not None and not isinstance(warning, list):
|
95
|
+
raise AssertionError("Parameter `warning` - Not а `list` type!")
|
96
|
+
if not isinstance(required, bool):
|
97
|
+
raise AssertionError("Parameter `required` - Not а `bool` type!")
|
98
|
+
if not isinstance(readonly, bool):
|
99
|
+
raise AssertionError("Parameter `readonly` - Not а `bool` type!")
|
100
|
+
except AssertionError as err:
|
101
|
+
logger.error(str(err))
|
102
|
+
raise err
|
95
103
|
|
96
104
|
def has_value(self, is_migrate: bool = False) -> bool:
|
97
|
-
"""Does the field value match the possible options in choices."""
|
105
|
+
"""Ramifice - Does the field value match the possible options in choices."""
|
98
106
|
value = self.value
|
99
107
|
if value is None:
|
100
108
|
value = self.default
|
@@ -1,18 +1,22 @@
|
|
1
|
-
"""Field of Model.
|
1
|
+
"""Ramifice - Field of Model.
|
2
2
|
|
3
3
|
Type of selective integer field with dynamic addition of elements.
|
4
4
|
"""
|
5
5
|
|
6
6
|
__all__ = ("ChoiceIntDynField",)
|
7
7
|
|
8
|
+
import logging
|
9
|
+
|
8
10
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
9
11
|
from ramifice.fields.general.field import Field
|
10
12
|
from ramifice.utils import constants
|
11
13
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
12
14
|
|
15
|
+
logger = logging.getLogger(__name__)
|
16
|
+
|
13
17
|
|
14
18
|
class ChoiceIntDynField(Field, ChoiceGroup, JsonMixin):
|
15
|
-
"""Field of Model.
|
19
|
+
"""Ramifice - Field of Model.
|
16
20
|
|
17
21
|
Type of selective integer field with dynamic addition of elements.
|
18
22
|
For simulate relationship Many-to-One.
|
@@ -31,24 +35,28 @@ class ChoiceIntDynField(Field, ChoiceGroup, JsonMixin):
|
|
31
35
|
readonly: bool = False,
|
32
36
|
):
|
33
37
|
if constants.DEBUG:
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
38
|
+
try:
|
39
|
+
if not isinstance(label, str):
|
40
|
+
raise AssertionError("Parameter `default` - Not а `str` type!")
|
41
|
+
if not isinstance(disabled, bool):
|
42
|
+
raise AssertionError("Parameter `disabled` - Not а `bool` type!")
|
43
|
+
if not isinstance(hide, bool):
|
44
|
+
raise AssertionError("Parameter `hide` - Not а `bool` type!")
|
45
|
+
if not isinstance(ignored, bool):
|
46
|
+
raise AssertionError("Parameter `ignored` - Not а `bool` type!")
|
47
|
+
if not isinstance(ignored, bool):
|
48
|
+
raise AssertionError("Parameter `ignored` - Not а `bool` type!")
|
49
|
+
if not isinstance(hint, str):
|
50
|
+
raise AssertionError("Parameter `hint` - Not а `str` type!")
|
51
|
+
if warning is not None and not isinstance(warning, list):
|
52
|
+
raise AssertionError("Parameter `warning` - Not а `list` type!")
|
53
|
+
if not isinstance(required, bool):
|
54
|
+
raise AssertionError("Parameter `required` - Not а `bool` type!")
|
55
|
+
if not isinstance(readonly, bool):
|
56
|
+
raise AssertionError("Parameter `readonly` - Not а `bool` type!")
|
57
|
+
except AssertionError as err:
|
58
|
+
logger.error(str(err))
|
59
|
+
raise err
|
52
60
|
|
53
61
|
Field.__init__(
|
54
62
|
self,
|
@@ -72,7 +80,7 @@ class ChoiceIntDynField(Field, ChoiceGroup, JsonMixin):
|
|
72
80
|
self.choices: list[list[int | str]] | None = None
|
73
81
|
|
74
82
|
def has_value(self, is_migrate: bool = False) -> bool:
|
75
|
-
"""Does the field value match the possible options in choices."""
|
83
|
+
"""Ramifice - Does the field value match the possible options in choices."""
|
76
84
|
if is_migrate:
|
77
85
|
return True
|
78
86
|
value = self.value
|
@@ -1,18 +1,22 @@
|
|
1
|
-
"""Field of Model.
|
1
|
+
"""Ramifice - Field of Model.
|
2
2
|
|
3
3
|
Type of selective integer field with static of elements.
|
4
4
|
"""
|
5
5
|
|
6
6
|
__all__ = ("ChoiceIntField",)
|
7
7
|
|
8
|
+
import logging
|
9
|
+
|
8
10
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
9
11
|
from ramifice.fields.general.field import Field
|
10
12
|
from ramifice.utils import constants
|
11
13
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
12
14
|
|
15
|
+
logger = logging.getLogger(__name__)
|
16
|
+
|
13
17
|
|
14
18
|
class ChoiceIntField(Field, ChoiceGroup, JsonMixin):
|
15
|
-
"""Field of Model.
|
19
|
+
"""Ramifice - Field of Model.
|
16
20
|
|
17
21
|
Type of selective integer field with static of elements.
|
18
22
|
With a single choice.
|
@@ -54,41 +58,45 @@ class ChoiceIntField(Field, ChoiceGroup, JsonMixin):
|
|
54
58
|
self.choices = choices
|
55
59
|
|
56
60
|
if constants.DEBUG:
|
57
|
-
|
58
|
-
if not
|
59
|
-
|
60
|
-
|
61
|
+
try:
|
62
|
+
if choices is not None:
|
63
|
+
if not isinstance(choices, list):
|
64
|
+
raise AssertionError("Parameter `choices` - Not а `list` type!")
|
65
|
+
if len(choices) == 0:
|
66
|
+
raise AssertionError(
|
67
|
+
"The `choices` parameter should not contain an empty list!"
|
68
|
+
)
|
69
|
+
if default is not None and not isinstance(default, int):
|
70
|
+
raise AssertionError("Parameter `default` - Not а `str` type!")
|
71
|
+
if default is not None and choices is not None and not self.has_value():
|
61
72
|
raise AssertionError(
|
62
|
-
"
|
73
|
+
"Parameter `default` does not coincide with "
|
74
|
+
+ "list of permissive values in `choicees`."
|
63
75
|
)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
)
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
raise
|
85
|
-
if not isinstance(required, bool):
|
86
|
-
raise AssertionError("Parameter `required` - Not а `bool` type!")
|
87
|
-
if not isinstance(readonly, bool):
|
88
|
-
raise AssertionError("Parameter `readonly` - Not а `bool` type!")
|
76
|
+
if not isinstance(label, str):
|
77
|
+
raise AssertionError("Parameter `default` - Not а `str` type!")
|
78
|
+
if not isinstance(disabled, bool):
|
79
|
+
raise AssertionError("Parameter `disabled` - Not а `bool` type!")
|
80
|
+
if not isinstance(hide, bool):
|
81
|
+
raise AssertionError("Parameter `hide` - Not а `bool` type!")
|
82
|
+
if not isinstance(ignored, bool):
|
83
|
+
raise AssertionError("Parameter `ignored` - Not а `bool` type!")
|
84
|
+
if not isinstance(ignored, bool):
|
85
|
+
raise AssertionError("Parameter `ignored` - Not а `bool` type!")
|
86
|
+
if not isinstance(hint, str):
|
87
|
+
raise AssertionError("Parameter `hint` - Not а `str` type!")
|
88
|
+
if warning is not None and not isinstance(warning, list):
|
89
|
+
raise AssertionError("Parameter `warning` - Not а `list` type!")
|
90
|
+
if not isinstance(required, bool):
|
91
|
+
raise AssertionError("Parameter `required` - Not а `bool` type!")
|
92
|
+
if not isinstance(readonly, bool):
|
93
|
+
raise AssertionError("Parameter `readonly` - Not а `bool` type!")
|
94
|
+
except AssertionError as err:
|
95
|
+
logger.error(str(err))
|
96
|
+
raise err
|
89
97
|
|
90
98
|
def has_value(self, is_migrate: bool = False) -> bool:
|
91
|
-
"""Does the field value match the possible options in choices."""
|
99
|
+
"""Ramifice - Does the field value match the possible options in choices."""
|
92
100
|
value = self.value
|
93
101
|
if value is None:
|
94
102
|
value = self.default
|
@@ -1,18 +1,22 @@
|
|
1
|
-
"""Field of Model.
|
1
|
+
"""Ramifice - Field of Model.
|
2
2
|
|
3
3
|
Type of selective integer field with dynamic addition of elements.
|
4
4
|
"""
|
5
5
|
|
6
6
|
__all__ = ("ChoiceIntMultDynField",)
|
7
7
|
|
8
|
+
import logging
|
9
|
+
|
8
10
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
9
11
|
from ramifice.fields.general.field import Field
|
10
12
|
from ramifice.utils import constants
|
11
13
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
12
14
|
|
15
|
+
logger = logging.getLogger(__name__)
|
16
|
+
|
13
17
|
|
14
18
|
class ChoiceIntMultDynField(Field, ChoiceGroup, JsonMixin):
|
15
|
-
"""Field of Model.
|
19
|
+
"""Ramifice - Field of Model.
|
16
20
|
|
17
21
|
Type of selective integer field with dynamic addition of elements.
|
18
22
|
For simulate relationship Many-to-Many.
|
@@ -30,24 +34,28 @@ class ChoiceIntMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
30
34
|
readonly: bool = False,
|
31
35
|
):
|
32
36
|
if constants.DEBUG:
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
37
|
+
try:
|
38
|
+
if not isinstance(label, str):
|
39
|
+
raise AssertionError("Parameter `default` - Not а `str` type!")
|
40
|
+
if not isinstance(disabled, bool):
|
41
|
+
raise AssertionError("Parameter `disabled` - Not а `bool` type!")
|
42
|
+
if not isinstance(hide, bool):
|
43
|
+
raise AssertionError("Parameter `hide` - Not а `bool` type!")
|
44
|
+
if not isinstance(ignored, bool):
|
45
|
+
raise AssertionError("Parameter `ignored` - Not а `bool` type!")
|
46
|
+
if not isinstance(ignored, bool):
|
47
|
+
raise AssertionError("Parameter `ignored` - Not а `bool` type!")
|
48
|
+
if not isinstance(hint, str):
|
49
|
+
raise AssertionError("Parameter `hint` - Not а `str` type!")
|
50
|
+
if warning is not None and not isinstance(warning, list):
|
51
|
+
raise AssertionError("Parameter `warning` - Not а `list` type!")
|
52
|
+
if not isinstance(required, bool):
|
53
|
+
raise AssertionError("Parameter `required` - Not а `bool` type!")
|
54
|
+
if not isinstance(readonly, bool):
|
55
|
+
raise AssertionError("Parameter `readonly` - Not а `bool` type!")
|
56
|
+
except AssertionError as err:
|
57
|
+
logger.error(str(err))
|
58
|
+
raise err
|
51
59
|
|
52
60
|
Field.__init__(
|
53
61
|
self,
|
@@ -72,7 +80,7 @@ class ChoiceIntMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
72
80
|
self.choices: list[list[int | str]] | None = None
|
73
81
|
|
74
82
|
def has_value(self, is_migrate: bool = False) -> bool:
|
75
|
-
"""Does the field value match the possible options in choices."""
|
83
|
+
"""Ramifice - Does the field value match the possible options in choices."""
|
76
84
|
if is_migrate:
|
77
85
|
return True
|
78
86
|
value = self.value
|