How can I redirect after POST in Pyramid?

前端 未结 6 1615
花落未央
花落未央 2021-02-04 03:50

I\'m trying to have my form submit to a route which will validate the data then redirect back to the original route.

For example:

  • User loads the page websi
6条回答
  •  南旧
    南旧 (楼主)
    2021-02-04 04:01

    I do this like so:

    from pyramid.httpexceptions import HTTPCreated
    
    response = HTTPCreated()
    response.location = self.request.resource_url( newResource )
    return response
    

    This sends the HTTP Created code , 201

提交回复
热议问题