How to produce a 303 Http Response in Django?

前端 未结 2 1210
轻奢々
轻奢々 2021-02-07 04:24

Last couple of days we were discussing at another question the best to manage randomness in a RESTful way; today I went to play a little bit with some ideas in Django only to fi

2条回答
  •  渐次进展
    2021-02-07 04:39

    You could just override HttpResponse, like the other Responses do:

    class HttpResponseSeeOther(HttpResponseRedirect):
        status_code = 303
    
    return HttpResponseSeeOther('/other-url/')
    

提交回复
热议问题