What the difference between using Django redirect and HttpResponseRedirect?

There is a difference between the two:

In the case of HttpResponseRedirect the first argument can only be a url.

redirect which will ultimately return a HttpResponseRedirect can accept a model, view, or url as it’s “to” argument. So it is a little more flexible in what it can “redirect” to.

I also like how redirect is shorter. So I’d use redirect over HttpResponseRedirect.

Both are fine to use though.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)