scan-data-labels: Don't return records with empty label

This commit is contained in:
Fam Zheng 2025-05-06 21:54:23 +01:00
parent f6fa95e414
commit 73bf4bd58a

View File

@ -1928,7 +1928,9 @@ class ScanDataLabelsView(BaseView):
def get(self, request):
ret = []
for x in ScanData.objects.all().order_by('pk').values('id', 'labels', 'image', 'code'):
for x in ScanData.objects.all().filter(labels__isnull=False).order_by('pk').values('id', 'labels', 'image', 'code'):
if not x.get('labels'):
continue
ret.append({
'id': x['id'],
'labels': x.get('labels'),