Skip to content

Commit d9527ef

Browse files
committed
Use dict instead of the AttrDict
1 parent 2f076fa commit d9527ef

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/django_elasticsearch_dsl_drf/viewsets.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
from .pagination import PageNumberPagination
2424
from .utils import DictionaryProxy
25+
from .versions import ELASTICSEARCH_GTE_7_0
2526

2627
__title__ = 'django_elasticsearch_dsl_drf.viewsets'
2728
__author__ = 'Artur Barseghyan <[email protected]>'
@@ -231,8 +232,12 @@ def get_object(self):
231232

232233
# May raise a permission denied
233234
self.check_object_permissions(self.request, obj)
235+
if ELASTICSEARCH_GTE_7_0:
236+
dictionary_proxy = DictionaryProxy(obj.to_dict())
237+
else:
238+
dictionary_proxy = DictionaryProxy(obj)
234239

235-
return DictionaryProxy(obj)
240+
return dictionary_proxy
236241

237242
elif count > 1:
238243
raise Http404(

0 commit comments

Comments
 (0)