这就是我解决问题的方法clients.models.Clients.DoesNotExist: Clients matching query does not exist
for r in orders_page:
try:
cls2 = cls.objects.get(related_uuid=r.related_uuid)
related_list.append(cls2)
except clients.models.Clients.DoesNotExist:
pass对于get empty有更好的解决方案吗?
发布于 2021-03-18 02:36:26
没有“内置”的方法可以做到这一点。如果对象不存在,Django每次都会引发DoesNotExist异常。
https://stackoverflow.com/questions/66679089
复制相似问题