feat: WMaterialFilter mtaskx根据batch_bind进行校验

This commit is contained in:
caoqianming 2024-11-21 13:34:15 +08:00
parent 1bfafdb0e4
commit 32158dfa77
1 changed files with 5 additions and 1 deletions

View File

@ -37,7 +37,11 @@ class WMaterialFilter(filters.FilterSet):
return queryset.filter(mgroup__id=value)|queryset.filter(belong_dept=Mgroup.objects.get(id=value).belong_dept, mgroup=None) return queryset.filter(mgroup__id=value)|queryset.filter(belong_dept=Mgroup.objects.get(id=value).belong_dept, mgroup=None)
def filter_mtaskx(self, queryset, name, value): def filter_mtaskx(self, queryset, name, value):
mtask = Mtask.objects.get(id=value)
if mtask.route and mtask.route.batch_bind:
return WMaterial.mat_in_qs(mtask=Mtask.objects.get(id=value), qs=queryset) return WMaterial.mat_in_qs(mtask=Mtask.objects.get(id=value), qs=queryset)
return queryset
class Meta: class Meta:
model = WMaterial model = WMaterial
fields = { fields = {