0

this is how I solve the problem 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

is there any better solution for get empty?

JopaBoga
  • 157
  • 11

1 Answers1

1

There is no 'built in' way to do this. Django will raise the DoesNotExist exception every time if the object does not exist .

Belhadjer Samir
  • 1,461
  • 7
  • 15