1👍
✅
You can catch models.DoesNotExist
exception.
def someview(request):
shift_users = TeamMember.objects.all()
weekday_shifts = WeekdayAssignment.objects.all()
for t in shift_users:
for ws in weekday_shifts:
try:
print(ws.triage_nam_3)
except TeamMember.DoesNotExist:
continue
Source:stackexchange.com