base-api-utils 1.1.117.dev2__py3-none-any.whl → 1.1.117.dev3__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.
- base_api_utils/serializers/v2/abstract_serializer.py +10 -1
- {base_api_utils-1.1.117.dev2.dist-info → base_api_utils-1.1.117.dev3.dist-info}/METADATA +1 -1
- {base_api_utils-1.1.117.dev2.dist-info → base_api_utils-1.1.117.dev3.dist-info}/RECORD +6 -6
- {base_api_utils-1.1.117.dev2.dist-info → base_api_utils-1.1.117.dev3.dist-info}/WHEEL +0 -0
- {base_api_utils-1.1.117.dev2.dist-info → base_api_utils-1.1.117.dev3.dist-info}/licenses/LICENSE +0 -0
- {base_api_utils-1.1.117.dev2.dist-info → base_api_utils-1.1.117.dev3.dist-info}/top_level.txt +0 -0
|
@@ -3,6 +3,7 @@ import copy
|
|
|
3
3
|
from .expands import ExpandMapping
|
|
4
4
|
from .query_params import normalize_none, parse_tree
|
|
5
5
|
|
|
6
|
+
|
|
6
7
|
class AbstractSerializer:
|
|
7
8
|
allowed_fields = None
|
|
8
9
|
allowed_relations = []
|
|
@@ -126,6 +127,13 @@ class AbstractSerializer:
|
|
|
126
127
|
ft = ctx.get("fields_tree")
|
|
127
128
|
if ft is None or (isinstance(ft, dict) and len(ft) == 0):
|
|
128
129
|
return fields
|
|
130
|
+
# Navigation-only fields_tree (every top-level key has a non-empty
|
|
131
|
+
# subtree pointing deeper) means the user only constrained nested
|
|
132
|
+
# levels and never listed a scalar at this one. Preserve defaults
|
|
133
|
+
# here and let the deeper constraints apply at child serializers.
|
|
134
|
+
has_explicit_leaf = any(not subtree for subtree in ft.values())
|
|
135
|
+
if not has_explicit_leaf:
|
|
136
|
+
return fields
|
|
129
137
|
keep = (
|
|
130
138
|
set(ft.keys())
|
|
131
139
|
| set(ctx.get("expand_tree", {}).keys())
|
|
@@ -169,4 +177,5 @@ class AbstractSerializer:
|
|
|
169
177
|
return ChildSerializer(context=self.get_child_context('field_name')).to_representation(obj)
|
|
170
178
|
"""
|
|
171
179
|
from .expands import _child_context
|
|
172
|
-
|
|
180
|
+
|
|
181
|
+
return _child_context(self._own_context, attr)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: base-api-utils
|
|
3
|
-
Version: 1.1.117.
|
|
3
|
+
Version: 1.1.117.dev3
|
|
4
4
|
Summary: Django Rest Framework micro services common utilities
|
|
5
5
|
Author-email: Román Gutierrez <roman@tipit.net>, Sebastian Marcet <sebastian@tipit.net>
|
|
6
6
|
Project-URL: Homepage, https://github.com/fntechgit/base-api-utils
|
|
@@ -44,7 +44,7 @@ base_api_utils/serializers/serializers_registry.py,sha256=V4teS5tCNQ2WdzN-tYNJSM
|
|
|
44
44
|
base_api_utils/serializers/task_result_serializer.py,sha256=oUqD9EDQr2oxyIpgZJ1lpSGKF5Vhhy25TOQUCGTPqFY,218
|
|
45
45
|
base_api_utils/serializers/timestamp_field.py,sha256=uZXbJ7BnabJylSZPt_dQEUBuT_XL3khhGjzJ08ji-DY,682
|
|
46
46
|
base_api_utils/serializers/v2/__init__.py,sha256=hOWxvmFSrKpkB19x3MPz37Pz1BjJqaymqs5Dt6m4_fA,241
|
|
47
|
-
base_api_utils/serializers/v2/abstract_serializer.py,sha256=
|
|
47
|
+
base_api_utils/serializers/v2/abstract_serializer.py,sha256=Ac8qhffxsrUwqqJf6x4zJ-8kACGoEpnlrtDRuFZElrg,6802
|
|
48
48
|
base_api_utils/serializers/v2/base_model_serializer.py,sha256=S9AO0GXUcOvA6wCO88VoSSVFHBwe2fFAHZe4gmZKn6M,720
|
|
49
49
|
base_api_utils/serializers/v2/expands.py,sha256=uVIAgw2eRKaL0dvJlvh3CqdQDvqvg1Iv0caH2lvIqT4,3992
|
|
50
50
|
base_api_utils/serializers/v2/query_params.py,sha256=6b6rnV0Ye37xWun72x7zHKtspWzn4tdf2gVaFEaqp9M,1821
|
|
@@ -98,8 +98,8 @@ base_api_utils/views/base_view.py,sha256=A49KZr03qxjBQvCLLdtbg4s3f9Gn9C63gwcpme2
|
|
|
98
98
|
base_api_utils/views/parent_children_crud.py,sha256=79vB044kmY9kefb6YxekPriO3FKYV85zn3PgCmSSKFw,3261
|
|
99
99
|
base_api_utils/views/root_entity_crud.py,sha256=eIhZfjouNxYAVIfGPuEPp80b50hM2CAG_L0nh6-Gdjw,2830
|
|
100
100
|
base_api_utils/views/tasks_result_view.py,sha256=StCfFsnpi4drUD73C_w4VLVpd546B5r8tTxB6JWoyRA,2065
|
|
101
|
-
base_api_utils-1.1.117.
|
|
102
|
-
base_api_utils-1.1.117.
|
|
103
|
-
base_api_utils-1.1.117.
|
|
104
|
-
base_api_utils-1.1.117.
|
|
105
|
-
base_api_utils-1.1.117.
|
|
101
|
+
base_api_utils-1.1.117.dev3.dist-info/licenses/LICENSE,sha256=JKqaWBs87qnqDsZ1EEF0gnWR2iSAh92F9TJ7tqg2OwQ,547
|
|
102
|
+
base_api_utils-1.1.117.dev3.dist-info/METADATA,sha256=sPMyYfHf9Gbm7EFIpSMVLvF55G80TmRqqMCjSAGVow8,2386
|
|
103
|
+
base_api_utils-1.1.117.dev3.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
104
|
+
base_api_utils-1.1.117.dev3.dist-info/top_level.txt,sha256=uRTtK_DlttSQ1sVajv2TKZy5XLVWawLxi2PUU-uCR7A,15
|
|
105
|
+
base_api_utils-1.1.117.dev3.dist-info/RECORD,,
|
|
File without changes
|
{base_api_utils-1.1.117.dev2.dist-info → base_api_utils-1.1.117.dev3.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{base_api_utils-1.1.117.dev2.dist-info → base_api_utils-1.1.117.dev3.dist-info}/top_level.txt
RENAMED
|
File without changes
|