2
You can extend your attribute
argument you’ve passed to the data
field with a full-scale function and reuse the DataResource
:
def filter_data_items(bundle):
res = DataResource()
new_bundle = Bundle(request=bundle.request)
objs = res.obj_get_list(new_bundle)
return objs.filter(parent_id=bundle.obj.pk)
res.obj_get_list
handles building and applying filters as defined per your DataResource
. You just need to filter it futher on parent_id
.
Source:stackexchange.com