fix: 获取检验模板只用单个2
This commit is contained in:
parent
57dfab3bb9
commit
f32adf3702
|
@ -172,9 +172,9 @@ class Qct(CommonAModel):
|
|||
return QctMat.objects.filter(qct=self)
|
||||
|
||||
@classmethod
|
||||
def get(cls, material:Material, tag:str):
|
||||
def get(cls, materialId:str, tag:str):
|
||||
try:
|
||||
qct = Qct.objects.get(qctmat__material=material, tags__contains=tag)
|
||||
qct = Qct.objects.get(qctmat__material__id=materialId, tags__contains=tag)
|
||||
except Qct.DoesNotExist:
|
||||
try:
|
||||
qct = Qct.objects.get(name="默认检验表")
|
||||
|
|
|
@ -61,7 +61,7 @@ class QctViewSet(CustomModelViewSet):
|
|||
"""
|
||||
data = request.data
|
||||
qct = Qct.get(data["material"], data["tag"])
|
||||
return Response(QctSerializer(instance=qct).data)
|
||||
return Response(QctDetailSerializer(instance=qct).data)
|
||||
|
||||
|
||||
class QctTestItemViewSet(CustomModelViewSet):
|
||||
|
|
Loading…
Reference in New Issue