How can I redirect after POST in Pyramid?

前端 未结 6 1533
花落未央
花落未央 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:11

    The Pyramid documentation has a particularly on-point section with the following example:

    from pyramid.httpexceptions import HTTPFound
    
    def myview(request):
        return HTTPFound(location='http://example.com')
    

提交回复
热议问题