wbcore 1.56.8__py2.py3-none-any.whl → 1.57.0__py2.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.
- wbcore/filters/mixins.py +1 -2
- wbcore/metadata/configs/fields.py +6 -1
- wbcore/serializers/fields/mixins.py +8 -0
- wbcore/serializers/fields/related.py +1 -1
- wbcore/utils/reportlab.py +7 -0
- {wbcore-1.56.8.dist-info → wbcore-1.57.0.dist-info}/METADATA +1 -1
- {wbcore-1.56.8.dist-info → wbcore-1.57.0.dist-info}/RECORD +8 -7
- {wbcore-1.56.8.dist-info → wbcore-1.57.0.dist-info}/WHEEL +0 -0
wbcore/filters/mixins.py
CHANGED
|
@@ -106,7 +106,6 @@ class WBCoreFilterMixin:
|
|
|
106
106
|
if initial is not None or self.allow_empty_initial:
|
|
107
107
|
lookup_expr["input_properties"]["initial"] = initial
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
lookup_expr["input_properties"]["required"] = True
|
|
109
|
+
lookup_expr["input_properties"]["required"] = self.required
|
|
111
110
|
representation["depends_on"] = self.depends_on
|
|
112
111
|
return representation, lookup_expr
|
|
@@ -10,8 +10,13 @@ class FieldsViewConfig(WBCoreViewConfig):
|
|
|
10
10
|
def get_metadata(self) -> dict:
|
|
11
11
|
fields = defaultdict(dict)
|
|
12
12
|
if (serializer_class := getattr(self.view, "get_serializer", None)) and (serializer := serializer_class()):
|
|
13
|
+
related_key_fields = []
|
|
13
14
|
for field_name, field in serializer.fields.items():
|
|
14
15
|
field_key, field_representation = field.get_representation(self.request, field_name)
|
|
16
|
+
# we need to get the representation of the related field last so that the key update properly (priority to the related field values)
|
|
17
|
+
if "related_key" in field_representation:
|
|
18
|
+
related_key_fields.append((field_key, field_representation))
|
|
19
|
+
fields[field_key].update(field_representation)
|
|
20
|
+
for field_key, field_representation in related_key_fields:
|
|
15
21
|
fields[field_key].update(field_representation)
|
|
16
|
-
|
|
17
22
|
return fields
|
|
@@ -33,6 +33,8 @@ class WBCoreSerializerFieldMixin:
|
|
|
33
33
|
read_only=False,
|
|
34
34
|
copyable=None,
|
|
35
35
|
related_key=None,
|
|
36
|
+
on_unsatisfied_deps="read_only",
|
|
37
|
+
clear_dependent_fields=True,
|
|
36
38
|
**kwargs,
|
|
37
39
|
):
|
|
38
40
|
if not decorators:
|
|
@@ -50,6 +52,8 @@ class WBCoreSerializerFieldMixin:
|
|
|
50
52
|
self._callable_read_only = read_only
|
|
51
53
|
read_only = True
|
|
52
54
|
self.related_key = related_key
|
|
55
|
+
self.on_unsatisfied_deps = on_unsatisfied_deps
|
|
56
|
+
self.clear_dependent_fields = clear_dependent_fields
|
|
53
57
|
super().__init__(*args, read_only=read_only, **kwargs)
|
|
54
58
|
|
|
55
59
|
def _evaluate_read_only(self, field_name, parent):
|
|
@@ -131,6 +135,10 @@ class WBCoreSerializerFieldMixin:
|
|
|
131
135
|
representation["math"] = self.math
|
|
132
136
|
if self.copyable:
|
|
133
137
|
representation["copyable"] = self.copyable
|
|
138
|
+
if self.on_unsatisfied_deps != "read_only":
|
|
139
|
+
representation["on_unsatisfied_deps"] = self.on_unsatisfied_deps
|
|
140
|
+
if self.clear_dependent_fields is not True:
|
|
141
|
+
representation["clear_dependent_fields"] = self.clear_dependent_fields
|
|
134
142
|
return field_name, representation
|
|
135
143
|
|
|
136
144
|
def validate_empty_values(self, data):
|
|
@@ -58,7 +58,7 @@ class PrimaryKeyRelatedField(WBCoreSerializerFieldMixin, serializers.PrimaryKeyR
|
|
|
58
58
|
)
|
|
59
59
|
|
|
60
60
|
def __init__(self, *args, queryset=None, read_only=False, **kwargs):
|
|
61
|
-
self.field_type = kwargs.pop("field_type", WBCoreType.
|
|
61
|
+
self.field_type = kwargs.pop("field_type", WBCoreType.PRIMARY_KEY.value)
|
|
62
62
|
if callable(read_only) and queryset is not None:
|
|
63
63
|
self._queryset = queryset # we unset any given queryset to be compliant with the RelatedField assertion
|
|
64
64
|
queryset = None
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from reportlab.platypus import Paragraph as BaseParagraph
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class FormattedParagraph(BaseParagraph):
|
|
5
|
+
def __init__(self, text, *args, **kwargs):
|
|
6
|
+
text = text.replace("<br>", "<br/>") # convert the HTML line break into a compatible XML line break tag
|
|
7
|
+
super().__init__(text, *args, **kwargs)
|
|
@@ -966,7 +966,7 @@ wbcore/filters/backends.py,sha256=7XX5LcFrAFE5jvFj5qSjww4VMux8aKRlcQKmZxdIiKY,73
|
|
|
966
966
|
wbcore/filters/defaults.py,sha256=poSD8Ww2NumwYjZ01zS0iBsNCmv6Bee1z3bDSYdX17A,1988
|
|
967
967
|
wbcore/filters/filterset.py,sha256=TTk4mQq9DFCXdyzMq3Ig6e5uIbmjsr4HT2kswOgiuPc,11775
|
|
968
968
|
wbcore/filters/lookups.py,sha256=IYuQqEcYutiXk9UpzY3qKSCaCR2vyllB0RXBj98o8Ao,1186
|
|
969
|
-
wbcore/filters/mixins.py,sha256=
|
|
969
|
+
wbcore/filters/mixins.py,sha256=eIXW2Wq_VO3sXioQKcYdyTvZPHS06tytcGo4ZHEasvA,4487
|
|
970
970
|
wbcore/filters/utils.py,sha256=wSs0g7mKF6n_ziSEDItfFYcuHwZTXyu78D6LHxzY2Bk,786
|
|
971
971
|
wbcore/filters/fields/__init__.py,sha256=ZucwBossNTlvcUfRullicg0ovghQEGO0jxY5eQ3UaEs,546
|
|
972
972
|
wbcore/filters/fields/booleans.py,sha256=6BrK3p1Bv_KIlVCeMOgJ7V8_P8tWQKBnxTOBOBSsGvE,175
|
|
@@ -1009,7 +1009,7 @@ wbcore/metadata/configs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
|
1009
1009
|
wbcore/metadata/configs/base.py,sha256=jxOuuisAAEMjvdvQY_1WSruEaNR9onmXn7W6NN95ogw,2790
|
|
1010
1010
|
wbcore/metadata/configs/documentations.py,sha256=Wv6vToaalOFkCY_KU8HOddpkfeMKsBoGlla_4LTbJ40,348
|
|
1011
1011
|
wbcore/metadata/configs/endpoints.py,sha256=peGTXR53IpOYcm0kBqDwMuIxxjjLYHRhDv0XWt6-OYQ,7143
|
|
1012
|
-
wbcore/metadata/configs/fields.py,sha256=
|
|
1012
|
+
wbcore/metadata/configs/fields.py,sha256=4R-C_wzz9R5BttzfiWH0MeCDF5_tkvJUGo8sk4XaWPI,1091
|
|
1013
1013
|
wbcore/metadata/configs/filter_fields.py,sha256=1jZyZHU8rBse2P69xFFRAn8VitEdevz5bPeniMk0vKs,2000
|
|
1014
1014
|
wbcore/metadata/configs/identifiers.py,sha256=4cntC5IarkENLrBnFf26uyfrZY3b4QDXtugvNc_VRhI,1025
|
|
1015
1015
|
wbcore/metadata/configs/ordering_fields.py,sha256=9ww1zwCFfL6XKGxMI2RKCcMhRS-dkFi3pYbQVbuKN_A,878
|
|
@@ -1103,11 +1103,11 @@ wbcore/serializers/fields/file.py,sha256=tDDK2bITiP7zxl9Ilzja2_gWae_lf9CkO1rDEBP
|
|
|
1103
1103
|
wbcore/serializers/fields/fsm.py,sha256=xUYxDj166PDnmDLggI4fShXdSunJVzbc8quFQioM3Yc,700
|
|
1104
1104
|
wbcore/serializers/fields/json.py,sha256=8SmEOW2hXnTTfuCztaxA8AA3qtTxhCZtft7BJm1yO6o,2225
|
|
1105
1105
|
wbcore/serializers/fields/list.py,sha256=cYmMBg9M10Qb_5z98CeP3SjE2bV-u7Z0xkzXr-C3xoA,4178
|
|
1106
|
-
wbcore/serializers/fields/mixins.py,sha256=
|
|
1106
|
+
wbcore/serializers/fields/mixins.py,sha256=sP1mEiD5tMZ4yCr-X0IkIY3RZwJcT0JokvontvRsDKw,7613
|
|
1107
1107
|
wbcore/serializers/fields/number.py,sha256=Lxhiy8KBMA8dzv2nKsHVtAaPgjZMNt0TQTgVujh_2BI,3473
|
|
1108
1108
|
wbcore/serializers/fields/other.py,sha256=3r_70JH_A_daS99LuwQWwa0LNtyosKW7QKJzZgQA-zo,1131
|
|
1109
1109
|
wbcore/serializers/fields/primary_key.py,sha256=yTbs5B2QlUX-XKEtop3JpwIPeP-FhM8u-2qDXM5q6u0,676
|
|
1110
|
-
wbcore/serializers/fields/related.py,sha256=
|
|
1110
|
+
wbcore/serializers/fields/related.py,sha256=mq7QhcjSG273G400ZueYJnNVNDlGgnUHLoAHaKRjW_Q,6355
|
|
1111
1111
|
wbcore/serializers/fields/text.py,sha256=8cmRiH1RpCDGzuUmO1zMmm8uiybXDMqyuBkjFblNMmQ,5060
|
|
1112
1112
|
wbcore/serializers/fields/types.py,sha256=eiSOajWwlZjFfXnMGjIakAa7WGzXHjtRQwT0LH-2_oA,983
|
|
1113
1113
|
wbcore/shares/__init__.py,sha256=uhHkbgHoFgbcsxHUPxNNzNs11oIjjQ7zIxG8FzsREAI,32
|
|
@@ -1211,6 +1211,7 @@ wbcore/utils/numbers.py,sha256=KaC2yNmaVMwe05uRvGvC_ayWJW_1dOgjswlqsB-QeoM,2289
|
|
|
1211
1211
|
wbcore/utils/prettytable.py,sha256=RnZ9VZpSZBaOVPyvcbdD17PeKp6pNN57PDfyILy1nlg,877
|
|
1212
1212
|
wbcore/utils/print.py,sha256=_CBbuAf2ZbjXQBedcvhe6jZAfNq2kjC_ImWlWDbeRCc,725
|
|
1213
1213
|
wbcore/utils/renderers.py,sha256=2q1ATrmzFFe03ofuKn2WZ3hK53aFwyEwCVbK0YxkdDM,520
|
|
1214
|
+
wbcore/utils/reportlab.py,sha256=gAvcZqpsx0-M9DxW_GvnXQbPFilmf18tQKhK3DqU-9Q,309
|
|
1214
1215
|
wbcore/utils/rrules.py,sha256=oqg1eY_X7CLN--UkTjPsKuF_FrtKi1no9-ITvYerrXM,2743
|
|
1215
1216
|
wbcore/utils/serializers.py,sha256=fn__UYJolYjg063OHmAt7zC9zxMxsqrVERpGhLzUK3o,418
|
|
1216
1217
|
wbcore/utils/settings.py,sha256=MCt48ZJO9nOzGPAFYJ-_o0uRCDUt3_yzEek6m4oZTYg,198
|
|
@@ -1229,6 +1230,6 @@ wbcore/viewsets/generics.py,sha256=lKDq9UY_Tyc56u1bqaIEvHGgoaXwXxpZ1c3fLVteptI,1
|
|
|
1229
1230
|
wbcore/viewsets/mixins.py,sha256=IdHd_uixOv3ExKoHxTgL5Bt8OELIwfYwhBZm0nsvZfc,12054
|
|
1230
1231
|
wbcore/viewsets/utils.py,sha256=4520Ij3ASM8lOa8QZkCqbBfOexVRiZu688eW-PGqMOA,882
|
|
1231
1232
|
wbcore/viewsets/viewsets.py,sha256=FPPESunEjlunDr5VFsjTfsquTS3iDSQkw0H6QjMKPqk,6574
|
|
1232
|
-
wbcore-1.
|
|
1233
|
-
wbcore-1.
|
|
1234
|
-
wbcore-1.
|
|
1233
|
+
wbcore-1.57.0.dist-info/METADATA,sha256=S2Im_-ZfGaGiK-1IaNBNvJUXbQuMDoR0jGNSOc7UDgQ,2332
|
|
1234
|
+
wbcore-1.57.0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
|
1235
|
+
wbcore-1.57.0.dist-info/RECORD,,
|
|
File without changes
|