how to check if object exists in a database and get the object django code example Example: check django object exists modelName.objects.filter(pk='id').exists()