django-rest-framework-datatables icon indicating copy to clipboard operation
django-rest-framework-datatables copied to clipboard

unused fields filtering removing nested fields

Open jerzyk opened this issue 6 years ago • 2 comments

_filter_unused_fields is building list of columns from request, lets assume that there is a field detail.name which is perfectly fine and properly serialized

in the next loop there is a list of keys build in the loop for each record, but this list contains only detail key which is not on the previously built list of columns - in this moment data dissapears from the response... of course, there is an option to keep data despite missing key (datatables_always_serialize list) - but in my opinion for the nested fields default approach should be to keep them without additional hassle

jerzyk avatar May 31 '18 01:05 jerzyk

Hi, Could you provide sample code so I can reproduce/understand better the issue, also, can you test this issue with version 0.4.0, does it fixes the issue ?

izimobil avatar Jun 22 '18 08:06 izimobil

sorry, I have right now a lot of work in different project, so writing from memory to not keep you waiting

model Detail(model) name = CharField()

model Master(model): code provides = FK(Detail)

in MasterSerializer: detail_name = charfield(source='detail.name')

jerzyk avatar Jun 22 '18 08:06 jerzyk