[Answered ]-Django catch exception in view and redirect

2👍

Just use try/except

def someview(request):
    try:
        myfunc(**kwargs):
    except ValidationError:
        return render("sometemplate.html")
    except IntegrityError:
        return render("sometemplate1.html")

    return render("success.html")

Leave a comment