嗨,我在 respurces.py 文件中有以下资源。
class SodResource(ModelResource):
class Meta:
queryset = Sod.objects.all().order_by('-rank')
filtering = {'sod_type': ALL, 'generic_value': ALL}
class DeptBpResource(ModelResource):
sod_setting = fields.ToManyField(SodResource, 'sod', null=True, full=True)
class Meta:
queryset = Dept_Bp.objects.all()
filtering = {
'dept_name': ALL,
'bp_name': ALL,
}
我可以搜索http://10.85.87.116:8000/fmea/api/v1/deptbp/?format=json&dept_name=DEQP&bp_name=Kaizen
。但我的目标是能够搜索sod_type
也(来自上述资源)。但是当我搜索时它只是返回与不缩小搜索范围http://10.85.87.116:8000/fmea/api/v1/deptbp/?format=json&dept_name=DEQP&bp_name=Kaizen&sod_type=1
相同的值。http://10.85.87.116:8000/fmea/api/v1/deptbp/?format=json&dept_name=DEQP&bp_name=Kaizen
对资源或美味派有点陌生。伙计们,这里怎么了?任何想法?提前致谢。