Skip to content

Commit dd7b59a

Browse files
committed
Allow __all__ to be specified as fields in DocumentSerializer
This is purely for cosmetic reasons allowing the drf convention to be used and increasing the readability of the code by allowing people to see that the expected fields will be "all".
1 parent b289a62 commit dd7b59a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/django_elasticsearch_dsl_drf/serializers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ def get_fields(self):
197197
declared_fields = copy.deepcopy(self._declared_fields)
198198
field_mapping = OrderedDict()
199199

200+
# Match drf convention of specifying "__all__" for all available fields
201+
# This is the existing behavior so we can ignore this value.
202+
if __fields == "__all__":
203+
__fields = None
204+
200205
for field_name, field_type in six.iteritems(document_fields):
201206
orig_name = field_name[:]
202207

0 commit comments

Comments
 (0)