I need to verify if an object exists and return the object, then based on that perform actions. What\'s the right way to do it without returning a 404?
if not RealEstateListing.objects.filter(slug_url=slug).exists():
# do stuff...
Sometimes it's more clear to use try: except: block and other times one-liner exists() makes the code looking clearer... all depends on your application logic.