Commit c0c08869 authored by Florent Chehab's avatar Florent Chehab
Browse files

Add a bypass option in the dictmodeview

parent 0d2b5992
......@@ -6,12 +6,14 @@ class DictModeViewSet(viewsets.ModelViewSet):
ViewSet that renders data as dict with keys corresponding to the model
primary key. Instead of list.
def list(self, request, *args, **kwargs):
response = super(viewsets.ModelViewSet, self).list( # pylint: disable=E1003
request, *args, **kwargs) # call the original 'list'
pk_attr_name = = {
d[pk_attr_name]: d for d in
if not self.BYPASS_DICT_MODE:
pk_attr_name = = {
d[pk_attr_name]: d for d in
return response
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment