Skip to content

Commit 9bd79b2

Browse files
committed
Fixed crash on missing data key in field
This may occur if datatables supplies a null or empty string, which is parsed as an unsearchable/-sortable field. (See filters.py/get_fields)
1 parent 97168fe commit 9bd79b2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

rest_framework_datatables/django_filters/backends.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ def parse_datatables_query(self, request, view):
6262
form_fields = {}
6363
field_queries = {}
6464
for f in query['fields']:
65+
if 'data' not in f:
66+
continue
67+
6568
form_fields[f['data']] = f['search_value']
6669
field_queries[f['data']] = f
6770
query['form_fields'] = form_fields

0 commit comments

Comments
 (0)