[Fixed]-Django redirect and break current flow

1👍

You could check the type of object and return accordingly (this answer is followed by the discussion in comments above).

def MyView(request):
   object = MyAuth(request)

   # if it is a redirect then return it.
   if isinstance(object, HttpResponseRedirect):
       return object

   # do stuff with object

   return render('some_template.html')
👤AKS

Leave a comment