ramifice 0.8.22__py3-none-any.whl → 0.8.26__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.
Files changed (84) hide show
  1. ramifice/__init__.py +8 -1
  2. ramifice/commons/__init__.py +2 -2
  3. ramifice/commons/general.py +11 -11
  4. ramifice/commons/indexes.py +8 -8
  5. ramifice/commons/many.py +6 -6
  6. ramifice/commons/one.py +8 -8
  7. ramifice/commons/tools.py +4 -4
  8. ramifice/commons/unit_manager.py +3 -3
  9. ramifice/fields/__init__.py +1 -1
  10. ramifice/fields/bool_field.py +16 -6
  11. ramifice/fields/choice_float_dyn_field.py +16 -6
  12. ramifice/fields/choice_float_field.py +20 -8
  13. ramifice/fields/choice_float_mult_dyn_field.py +16 -6
  14. ramifice/fields/choice_float_mult_field.py +20 -8
  15. ramifice/fields/choice_int_dyn_field.py +16 -6
  16. ramifice/fields/choice_int_field.py +20 -8
  17. ramifice/fields/choice_int_mult_dyn_field.py +16 -6
  18. ramifice/fields/choice_int_mult_field.py +20 -8
  19. ramifice/fields/choice_text_dyn_field.py +16 -6
  20. ramifice/fields/choice_text_field.py +20 -8
  21. ramifice/fields/choice_text_mult_dyn_field.py +16 -6
  22. ramifice/fields/choice_text_mult_field.py +20 -8
  23. ramifice/fields/color_field.py +24 -11
  24. ramifice/fields/date_field.py +25 -10
  25. ramifice/fields/date_time_field.py +25 -10
  26. ramifice/fields/email_field.py +21 -7
  27. ramifice/fields/file_field.py +25 -10
  28. ramifice/fields/float_field.py +25 -7
  29. ramifice/fields/general/__init__.py +1 -1
  30. ramifice/fields/general/choice_group.py +9 -10
  31. ramifice/fields/general/date_group.py +11 -11
  32. ramifice/fields/general/field.py +13 -13
  33. ramifice/fields/general/file_group.py +10 -10
  34. ramifice/fields/general/number_group.py +8 -8
  35. ramifice/fields/general/text_group.py +10 -10
  36. ramifice/fields/id_field.py +20 -15
  37. ramifice/fields/image_field.py +25 -9
  38. ramifice/fields/integer_field.py +25 -7
  39. ramifice/fields/ip_field.py +21 -7
  40. ramifice/fields/password_field.py +21 -12
  41. ramifice/fields/phone_field.py +22 -8
  42. ramifice/fields/slug_field.py +17 -6
  43. ramifice/fields/text_field.py +24 -7
  44. ramifice/fields/url_field.py +19 -19
  45. ramifice/models/__init__.py +7 -1
  46. ramifice/models/decorator.py +3 -3
  47. ramifice/models/model.py +16 -16
  48. ramifice/paladins/__init__.py +17 -2
  49. ramifice/paladins/add_valid.py +3 -3
  50. ramifice/paladins/check.py +3 -3
  51. ramifice/paladins/delete.py +3 -3
  52. ramifice/paladins/groups/__init__.py +1 -1
  53. ramifice/paladins/groups/bool_group.py +3 -3
  54. ramifice/paladins/groups/choice_group.py +3 -3
  55. ramifice/paladins/groups/date_group.py +3 -3
  56. ramifice/paladins/groups/file_group.py +3 -3
  57. ramifice/paladins/groups/id_group.py +3 -3
  58. ramifice/paladins/groups/img_group.py +3 -3
  59. ramifice/paladins/groups/num_group.py +3 -3
  60. ramifice/paladins/groups/pass_group.py +3 -3
  61. ramifice/paladins/groups/slug_group.py +3 -3
  62. ramifice/paladins/groups/text_group.py +3 -3
  63. ramifice/paladins/hooks.py +8 -8
  64. ramifice/paladins/indexing.py +3 -3
  65. ramifice/paladins/password.py +4 -4
  66. ramifice/paladins/refrash.py +3 -3
  67. ramifice/paladins/save.py +3 -3
  68. ramifice/paladins/tools.py +6 -6
  69. ramifice/paladins/validation.py +4 -4
  70. ramifice/utils/__init__.py +13 -1
  71. ramifice/utils/constants.py +1 -1
  72. ramifice/utils/errors.py +23 -23
  73. ramifice/utils/fixtures.py +2 -2
  74. ramifice/utils/migration.py +8 -8
  75. ramifice/utils/{mixins/json_converter.py → mixins.py} +6 -6
  76. ramifice/utils/tools.py +12 -12
  77. ramifice/utils/translations.py +5 -5
  78. ramifice/utils/unit.py +10 -10
  79. {ramifice-0.8.22.dist-info → ramifice-0.8.26.dist-info}/METADATA +4 -4
  80. ramifice-0.8.26.dist-info/RECORD +83 -0
  81. ramifice/utils/mixins/__init__.py +0 -5
  82. ramifice-0.8.22.dist-info/RECORD +0 -84
  83. {ramifice-0.8.22.dist-info → ramifice-0.8.26.dist-info}/WHEEL +0 -0
  84. {ramifice-0.8.22.dist-info → ramifice-0.8.26.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
1
- """Ramifice - Field of Model for enter date and time."""
1
+ """Field of Model for enter date and time."""
2
2
 
3
3
  __all__ = ("DateTimeField",)
4
4
 
@@ -18,23 +18,38 @@ logger = logging.getLogger(__name__)
18
18
 
19
19
 
20
20
  class DateTimeField(Field, DateGroup):
21
- """Ramifice - Field of Model for enter date and time."""
21
+ """Field of Model for enter date and time.
22
+
23
+ Agrs:
24
+ label: Text label for a web form field.
25
+ placeholder: Displays prompt text.
26
+ default: Value by default.
27
+ hide: Hide field from user.
28
+ disabled: Blocks access and modification of the element.
29
+ ignored: If true, the value of this field is not saved in the database.
30
+ hint: An alternative for the `placeholder` parameter.
31
+ warning: Warning information.
32
+ required: Required field.
33
+ readonly: Specifies that the field cannot be modified by the user.
34
+ max_date: Maximum allowed date and time.
35
+ min_date: Minimum allowed date and time.
36
+ """
22
37
 
23
38
  def __init__( # noqa: D107
24
39
  self,
25
40
  label: str = "",
26
- disabled: bool = False,
41
+ placeholder: str = "",
42
+ default: datetime | None = None,
27
43
  hide: bool = False,
44
+ disabled: bool = False,
28
45
  ignored: bool = False,
29
46
  hint: str = "",
30
47
  warning: list[str] | None = None,
31
- default: datetime | None = None,
32
- placeholder: str = "",
33
48
  required: bool = False,
34
49
  readonly: bool = False,
35
50
  max_date: datetime | None = None,
36
51
  min_date: datetime | None = None,
37
- ):
52
+ ) -> None:
38
53
  if constants.DEBUG:
39
54
  try:
40
55
  if max_date is not None:
@@ -103,7 +118,7 @@ class DateTimeField(Field, DateGroup):
103
118
  self.default = default
104
119
 
105
120
  def to_dict(self) -> dict[str, Any]:
106
- """Ramifice - Convert object instance to a dictionary."""
121
+ """Convert object instance to a dictionary."""
107
122
  json_dict: dict[str, Any] = {}
108
123
  current_locale = translations.CURRENT_LOCALE
109
124
  for name, value in self.__dict__.items():
@@ -119,12 +134,12 @@ class DateTimeField(Field, DateGroup):
119
134
  return json_dict
120
135
 
121
136
  def to_json(self) -> str:
122
- """Ramifice - Convert object instance to a JSON string."""
137
+ """Convert object instance to a JSON string."""
123
138
  return orjson.dumps(self.to_dict()).decode("utf-8")
124
139
 
125
140
  @classmethod
126
141
  def from_dict(cls, json_dict: dict[str, Any]) -> Any:
127
- """Ramifice - Convert JSON string to a object instance."""
142
+ """Convert JSON string to a object instance."""
128
143
  obj = cls()
129
144
  for name, value in json_dict.items():
130
145
  if name == "value" and value is not None:
@@ -135,6 +150,6 @@ class DateTimeField(Field, DateGroup):
135
150
 
136
151
  @classmethod
137
152
  def from_json(cls, json_str: str) -> Any:
138
- """Ramifice - Convert JSON string to a object instance."""
153
+ """Convert JSON string to a object instance."""
139
154
  json_dict = orjson.loads(json_str)
140
155
  return cls.from_dict(json_dict)
@@ -1,4 +1,4 @@
1
- """Ramifice - Field of Model for enter email address."""
1
+ """Field of Model for enter email address."""
2
2
 
3
3
  __all__ = ("EmailField",)
4
4
 
@@ -9,28 +9,42 @@ from email_validator import EmailNotValidError, validate_email
9
9
  from ramifice.fields.general.field import Field
10
10
  from ramifice.fields.general.text_group import TextGroup
11
11
  from ramifice.utils import constants
12
- from ramifice.utils.mixins.json_converter import JsonMixin
12
+ from ramifice.utils.mixins import JsonMixin
13
13
 
14
14
  logger = logging.getLogger(__name__)
15
15
 
16
16
 
17
17
  class EmailField(Field, TextGroup, JsonMixin):
18
- """Ramifice - Field of Model for enter email address."""
18
+ """Field of Model for enter email address.
19
+
20
+ Agrs:
21
+ label: Text label for a web form field.
22
+ placeholder: Displays prompt text.
23
+ default: Value by default.
24
+ hide: Hide field from user.
25
+ disabled: Blocks access and modification of the element.
26
+ ignored: If true, the value of this field is not saved in the database.
27
+ hint: An alternative for the `placeholder` parameter.
28
+ warning: Warning information.
29
+ required: Required field.
30
+ readonly: Specifies that the field cannot be modified by the user.
31
+ unique: The unique value of a field in a collection.
32
+ """
19
33
 
20
34
  def __init__( # noqa: D107
21
35
  self,
22
36
  label: str = "",
23
- disabled: bool = False,
37
+ placeholder: str = "",
38
+ default: str | None = None,
24
39
  hide: bool = False,
40
+ disabled: bool = False,
25
41
  ignored: bool = False,
26
42
  hint: str = "",
27
43
  warning: list[str] | None = None,
28
- default: str | None = None,
29
- placeholder: str = "",
30
44
  required: bool = False,
31
45
  readonly: bool = False,
32
46
  unique: bool = False,
33
- ):
47
+ ) -> None:
34
48
  if constants.DEBUG:
35
49
  try:
36
50
  if default is not None:
@@ -1,4 +1,4 @@
1
- """Ramifice - Field of Model for upload file."""
1
+ """Field of Model for upload file."""
2
2
 
3
3
  __all__ = ("FileField",)
4
4
 
@@ -17,30 +17,45 @@ from ramifice.fields.general.file_group import FileGroup
17
17
  from ramifice.utils import constants
18
18
  from ramifice.utils.constants import MEDIA_ROOT, MEDIA_URL
19
19
  from ramifice.utils.errors import FileHasNoExtensionError
20
- from ramifice.utils.mixins.json_converter import JsonMixin
20
+ from ramifice.utils.mixins import JsonMixin
21
21
 
22
22
  logger = logging.getLogger(__name__)
23
23
 
24
24
 
25
25
  class FileField(Field, FileGroup, JsonMixin):
26
- """Ramifice - Field of Model for upload file."""
26
+ """Field of Model for upload file.
27
+
28
+ Agrs:
29
+ label: Text label for a web form field.
30
+ placeholder: Displays prompt text.
31
+ default: Value by default.
32
+ hide: Hide field from user.
33
+ disabled: Blocks access and modification of the element.
34
+ ignored: If true, the value of this field is not saved in the database.
35
+ hint: An alternative for the `placeholder` parameter.
36
+ warning: Warning information.
37
+ required: Required field.
38
+ max_size: The maximum allowed file size in bytes.
39
+ target_dir: Directory for files inside media directory.
40
+ accept: Describing which file types to allow. Example: ".pdf,.doc,.docx,application/msword".
41
+ """
27
42
 
28
43
  def __init__( # noqa: D107
29
44
  self,
30
45
  label: str = "",
31
- disabled: bool = False,
46
+ placeholder: str = "",
47
+ default: str | None = None,
32
48
  hide: bool = False,
49
+ disabled: bool = False,
33
50
  ignored: bool = False,
34
51
  hint: str = "",
35
52
  warning: list[str] | None = None,
36
53
  required: bool = False,
37
54
  # The maximum size of the file in bytes.
38
55
  max_size: int = 2097152, # 2 MB = 2097152 Bytes (in binary)
39
- default: str | None = None,
40
- placeholder: str = "",
41
56
  target_dir: str = "files",
42
- accept: str = "",
43
- ):
57
+ accept: str = "", # Example: ".pdf,.doc,.docx,application/msword"
58
+ ) -> None:
44
59
  if constants.DEBUG:
45
60
  try:
46
61
  if default is not None:
@@ -108,7 +123,7 @@ class FileField(Field, FileGroup, JsonMixin):
108
123
  filename: str | None = None,
109
124
  is_delete: bool = False,
110
125
  ) -> None:
111
- """Ramifice - Convert base64 to a file,
126
+ """Convert base64 to a file,
112
127
  get file information and save in the target directory.
113
128
  """ # noqa: D205
114
129
  base64_str = base64_str or None
@@ -164,7 +179,7 @@ class FileField(Field, FileGroup, JsonMixin):
164
179
  src_path: str | None = None,
165
180
  is_delete: bool = False,
166
181
  ) -> None:
167
- """Ramifice - Get file information and copy the file to the target directory."""
182
+ """Get file information and copy the file to the target directory."""
168
183
  src_path = src_path or None
169
184
  file_info: dict[str, str | int | bool] = {"save_as_is": False}
170
185
  file_info["is_new_file"] = True
@@ -1,4 +1,4 @@
1
- """Ramifice - Field of Model for enter (float) number."""
1
+ """Field of Model for enter (float) number."""
2
2
 
3
3
  __all__ = ("FloatField",)
4
4
 
@@ -8,24 +8,42 @@ from typing import Literal
8
8
  from ramifice.fields.general.field import Field
9
9
  from ramifice.fields.general.number_group import NumberGroup
10
10
  from ramifice.utils import constants
11
- from ramifice.utils.mixins.json_converter import JsonMixin
11
+ from ramifice.utils.mixins import JsonMixin
12
12
 
13
13
  logger = logging.getLogger(__name__)
14
14
 
15
15
 
16
16
  class FloatField(Field, NumberGroup, JsonMixin):
17
- """Ramifice - Field of Model for enter (float) number."""
17
+ """Field of Model for enter (float) number.
18
+
19
+ Agrs:
20
+ label: Text label for a web form field.
21
+ placeholder: Displays prompt text.
22
+ default: Value by default.
23
+ hide: Hide field from user.
24
+ disabled: Blocks access and modification of the element.
25
+ ignored: If true, the value of this field is not saved in the database.
26
+ hint: An alternative for the `placeholder` parameter.
27
+ warning: Warning information.
28
+ required: Required field.
29
+ readonly: Specifies that the field cannot be modified by the user.
30
+ unique: The unique value of a field in a collection.
31
+ max_number: Maximum allowed number.
32
+ min_number: Minimum allowed number.
33
+ step: Increment step for numeric fields.
34
+ input_type: Field type - `number` or `range`.
35
+ """
18
36
 
19
37
  def __init__( # noqa: D107
20
38
  self,
21
39
  label: str = "",
22
- disabled: bool = False,
40
+ placeholder: str = "",
41
+ default: float | None = None,
23
42
  hide: bool = False,
43
+ disabled: bool = False,
24
44
  ignored: bool = False,
25
45
  hint: str = "",
26
46
  warning: list[str] | None = None,
27
- default: float | None = None,
28
- placeholder: str = "",
29
47
  required: bool = False,
30
48
  readonly: bool = False,
31
49
  unique: bool = False,
@@ -33,7 +51,7 @@ class FloatField(Field, NumberGroup, JsonMixin):
33
51
  min_number: float | None = None,
34
52
  step: float = 1.0,
35
53
  input_type: Literal["number", "range"] = "number",
36
- ):
54
+ ) -> None:
37
55
  if constants.DEBUG:
38
56
  try:
39
57
  if input_type not in ["number", "range"]:
@@ -1 +1 @@
1
- """Ramifice - Abstract classes for the fields."""
1
+ """Abstract classes for the fields."""
@@ -1,4 +1,4 @@
1
- """Ramifice - General additional parameters for choice fields."""
1
+ """General additional parameters for choice fields."""
2
2
 
3
3
  __all__ = ("ChoiceGroup",)
4
4
 
@@ -6,15 +6,14 @@ from abc import ABCMeta
6
6
 
7
7
 
8
8
  class ChoiceGroup(metaclass=ABCMeta):
9
- """Ramifice - General additional parameters for choice fields.
9
+ """General additional parameters for choice fields.
10
10
 
11
- Attributes:
12
- input_type -- Input type for a web form field.
13
- placeholder -- Displays prompt text.
14
- required -- Required field.
15
- readonly -- Specifies that the field cannot be modified by the user.
16
- unique -- The unique value of a field in a collection.
17
- multiple -- Specifies that multiple options can be selected at once.
11
+ Args:
12
+ placeholder: Displays prompt text.
13
+ required: Required field.
14
+ readonly: Specifies that the field cannot be modified by the user.
15
+ unique: The unique value of a field in a collection.
16
+ multiple: Specifies that multiple options can be selected at once.
18
17
  """
19
18
 
20
19
  def __init__( # noqa: D107
@@ -24,7 +23,7 @@ class ChoiceGroup(metaclass=ABCMeta):
24
23
  readonly: bool = False,
25
24
  unique: bool = False,
26
25
  multiple: bool = False,
27
- ):
26
+ ) -> None:
28
27
  self.placeholder = placeholder
29
28
  self.required = required
30
29
  self.readonly = readonly
@@ -1,4 +1,4 @@
1
- """Ramifice - General additional parameters for date|datetime fields."""
1
+ """General additional parameters for date|datetime fields."""
2
2
 
3
3
  __all__ = ("DateGroup",)
4
4
 
@@ -7,16 +7,16 @@ from datetime import datetime
7
7
 
8
8
 
9
9
  class DateGroup(metaclass=ABCMeta):
10
- """Ramifice - General additional parameters for date|datetime fields.
10
+ """General additional parameters for date|datetime fields.
11
11
 
12
- Attributes:
13
- input_type -- Input type for a web form field.
14
- placeholder -- Displays prompt text.
15
- required -- Required field.
16
- readonly -- Specifies that the field cannot be modified by the user.
17
- unique -- The unique value of a field in a collection.
18
- max_date -- Maximum allowed date.
19
- min_date -- Minimum allowed date.
12
+ Args:
13
+ input_type: Input type for a web form field.
14
+ placeholder: Displays prompt text.
15
+ required: Required field.
16
+ readonly: Specifies that the field cannot be modified by the user.
17
+ unique: The unique value of a field in a collection.
18
+ max_date: Maximum allowed date.
19
+ min_date: Minimum allowed date.
20
20
  """
21
21
 
22
22
  def __init__( # noqa: D107
@@ -28,7 +28,7 @@ class DateGroup(metaclass=ABCMeta):
28
28
  unique: bool = False,
29
29
  max_date: datetime | None = None,
30
30
  min_date: datetime | None = None,
31
- ):
31
+ ) -> None:
32
32
  self.input_type = input_type
33
33
  self.value: datetime | None = None
34
34
  self.placeholder = placeholder
@@ -1,4 +1,4 @@
1
- """Ramifice - General parameters for all types fields of Model."""
1
+ """General parameters for all types fields of Model."""
2
2
 
3
3
  __all__ = ("Field",)
4
4
 
@@ -6,18 +6,18 @@ from abc import ABCMeta
6
6
 
7
7
 
8
8
  class Field(metaclass=ABCMeta):
9
- """Ramifice - General parameters for all types fields of Model.
9
+ """General parameters for all types fields of Model.
10
10
 
11
- Attributes:
12
- label -- Text label for a web form field.
13
- disabled -- Blocks access and modification of the element.
14
- hide -- Hide field from user.
15
- ignored -- If true, the value of this field is not saved in the database.
16
- hint -- An alternative for the `placeholder` parameter.
17
- warning -- Warning information.
18
- errors -- The value is determined automatically.
19
- field_type -- Field type - ClassName.
20
- group -- To optimize field traversal in the `check` method.
11
+ Args:
12
+ label: Text label for a web form field.
13
+ disabled: Blocks access and modification of the element.
14
+ hide: Hide field from user.
15
+ ignored: If true, the value of this field is not saved in the database.
16
+ hint: An alternative for the `placeholder` parameter.
17
+ warning: Warning information.
18
+ errors: The value is determined automatically.
19
+ field_type: Field type - ClassName.
20
+ group: To optimize field traversal in the `check` method.
21
21
  """
22
22
 
23
23
  def __init__( # noqa: D107
@@ -31,7 +31,7 @@ class Field(metaclass=ABCMeta):
31
31
  errors: list[str] = [],
32
32
  field_type: str = "",
33
33
  group: str = "",
34
- ):
34
+ ) -> None:
35
35
  self.id = ""
36
36
  self.label = label
37
37
  self.name = ""
@@ -1,4 +1,4 @@
1
- """Ramifice - General additional parameters for file fields."""
1
+ """General additional parameters for file fields."""
2
2
 
3
3
  __all__ = ("FileGroup",)
4
4
 
@@ -6,15 +6,15 @@ from abc import ABCMeta
6
6
 
7
7
 
8
8
  class FileGroup(metaclass=ABCMeta):
9
- """Ramifice - General additional parameters for file fields.
9
+ """General additional parameters for file fields.
10
10
 
11
- Attributes:
12
- placeholder -- Displays prompt text.
13
- required -- Required field.
14
- max_size -- The maximum allowed file size in bytes.
15
- default -- Default file path.
16
- target_dir -- Directory for files inside media directory.
17
- accept -- Describing which file types to allow.
11
+ Args:
12
+ placeholder: Displays prompt text.
13
+ required: Required field.
14
+ max_size: The maximum allowed file size in bytes.
15
+ default: Default file path.
16
+ target_dir: Directory for files inside media directory.
17
+ accept: Describing which file types to allow.
18
18
  """
19
19
 
20
20
  def __init__( # noqa: D107
@@ -25,7 +25,7 @@ class FileGroup(metaclass=ABCMeta):
25
25
  default: str | None = None,
26
26
  target_dir: str = "",
27
27
  accept: str = "",
28
- ):
28
+ ) -> None:
29
29
  self.input_type = "file"
30
30
  self.placeholder = placeholder
31
31
  self.required = required
@@ -1,4 +1,4 @@
1
- """Ramifice - General additional parameters for number fields."""
1
+ """General additional parameters for number fields."""
2
2
 
3
3
  __all__ = ("NumberGroup",)
4
4
 
@@ -6,13 +6,13 @@ from abc import ABCMeta
6
6
 
7
7
 
8
8
  class NumberGroup(metaclass=ABCMeta):
9
- """Ramifice - General additional parameters for number fields.
9
+ """General additional parameters for number fields.
10
10
 
11
- Attributes:
12
- placeholder -- Displays prompt text.
13
- required -- Required field.
14
- readonly -- Specifies that the field cannot be modified by the user.
15
- unique -- The unique value of a field in a collection.
11
+ Args:
12
+ placeholder: Displays prompt text.
13
+ required: Required field.
14
+ readonly: Specifies that the field cannot be modified by the user.
15
+ unique: The unique value of a field in a collection.
16
16
  """
17
17
 
18
18
  def __init__( # noqa: D107
@@ -21,7 +21,7 @@ class NumberGroup(metaclass=ABCMeta):
21
21
  required: bool = False,
22
22
  readonly: bool = False,
23
23
  unique: bool = False,
24
- ):
24
+ ) -> None:
25
25
  self.placeholder = placeholder
26
26
  self.required = required
27
27
  self.readonly = readonly
@@ -1,4 +1,4 @@
1
- """Ramifice - General additional parameters for text fields."""
1
+ """General additional parameters for text fields."""
2
2
 
3
3
  __all__ = ("TextGroup",)
4
4
 
@@ -6,14 +6,14 @@ from abc import ABCMeta
6
6
 
7
7
 
8
8
  class TextGroup(metaclass=ABCMeta):
9
- """Ramifice - General additional parameters for text fields.
9
+ """General additional parameters for text fields.
10
10
 
11
- Attributes:
12
- input_type -- Input type for a web form field.
13
- placeholder -- Displays prompt text.
14
- required -- Required field.
15
- readonly -- Specifies that the field cannot be modified by the user.
16
- unique -- The unique value of a field in a collection.
11
+ Args:
12
+ input_type: Input type for a web form field.
13
+ placeholder: Displays prompt text.
14
+ required: Required field.
15
+ readonly: Specifies that the field cannot be modified by the user.
16
+ unique: The unique value of a field in a collection.
17
17
  """
18
18
 
19
19
  def __init__( # noqa: D107
@@ -23,7 +23,7 @@ class TextGroup(metaclass=ABCMeta):
23
23
  required: bool = False,
24
24
  readonly: bool = False,
25
25
  unique: bool = False,
26
- ):
26
+ ) -> None:
27
27
  self.input_type = input_type
28
28
  self.value: str | None = None
29
29
  self.placeholder = placeholder
@@ -32,7 +32,7 @@ class TextGroup(metaclass=ABCMeta):
32
32
  self.unique = unique
33
33
 
34
34
  def __len__(self) -> int:
35
- """Ramifice - Return length of field `value`."""
35
+ """Return length of field `value`."""
36
36
  value = self.value
37
37
  if value is None:
38
38
  return 0
@@ -1,4 +1,4 @@
1
- """Ramifice - Field of Model for enter identifier of document."""
1
+ """Field of Model for enter identifier of document."""
2
2
 
3
3
  __all__ = ("IDField",)
4
4
 
@@ -15,29 +15,34 @@ logger = logging.getLogger(__name__)
15
15
 
16
16
 
17
17
  class IDField(Field):
18
- """Ramifice - Field of Model for enter identifier of document.
18
+ """Field of Model for enter identifier of document.
19
19
 
20
- Attributes:
21
- input_type -- Input type for a web form field.
22
- placeholder -- Displays prompt text.
23
- required -- Required field.
24
- readonly -- Specifies that the field cannot be modified by the user.
25
- unique -- The unique value of a field in a collection.
20
+ Agrs:
21
+ label: Text label for a web form field.
22
+ placeholder: Displays prompt text.
23
+ hide: Hide field from user.
24
+ disabled: Blocks access and modification of the element.
25
+ ignored: If true, the value of this field is not saved in the database.
26
+ hint: An alternative for the `placeholder` parameter.
27
+ warning: Warning information.
28
+ required: Required field.
29
+ readonly: Specifies that the field cannot be modified by the user.
30
+ unique: The unique value of a field in a collection.
26
31
  """
27
32
 
28
33
  def __init__( # noqa: D107
29
34
  self,
30
35
  label: str = "",
31
- disabled: bool = False,
36
+ placeholder: str = "",
32
37
  hide: bool = False,
38
+ disabled: bool = False,
33
39
  ignored: bool = False,
34
40
  hint: str = "",
35
41
  warning: list[str] | None = None,
36
- placeholder: str = "",
37
42
  required: bool = False,
38
43
  readonly: bool = False,
39
44
  unique: bool = False,
40
- ):
45
+ ) -> None:
41
46
  if constants.DEBUG:
42
47
  try:
43
48
  if not isinstance(label, str):
@@ -87,7 +92,7 @@ class IDField(Field):
87
92
  self.alerts: list[str] = []
88
93
 
89
94
  def to_dict(self) -> dict[str, Any]:
90
- """Ramifice - Convert object instance to a dictionary."""
95
+ """Convert object instance to a dictionary."""
91
96
  json_dict: dict[str, Any] = {}
92
97
  for name, data in self.__dict__.items():
93
98
  if not callable(data):
@@ -98,12 +103,12 @@ class IDField(Field):
98
103
  return json_dict
99
104
 
100
105
  def to_json(self) -> str:
101
- """Ramifice - Convert object instance to a JSON string."""
106
+ """Convert object instance to a JSON string."""
102
107
  return orjson.dumps(self.to_dict()).decode("utf-8")
103
108
 
104
109
  @classmethod
105
110
  def from_dict(cls, json_dict: dict[str, Any]) -> Any:
106
- """Ramifice - Convert JSON string to a object instance."""
111
+ """Convert JSON string to a object instance."""
107
112
  obj = cls()
108
113
  for name, data in json_dict.items():
109
114
  if name == "value" and data is not None:
@@ -114,6 +119,6 @@ class IDField(Field):
114
119
 
115
120
  @classmethod
116
121
  def from_json(cls, json_str: str) -> Any:
117
- """Ramifice - Convert JSON string to a object instance."""
122
+ """Convert JSON string to a object instance."""
118
123
  json_dict = orjson.loads(json_str)
119
124
  return cls.from_dict(json_dict)