开发者

How to: Click button, then do stuff, then show confirmation in Django

Basic question, but I can't find a simple answer anywhere.

What is the best way to do the following in Django:

  1. User pushes button
  2. Some Python code gets crunched server-side
  3. 开发者_如何学编程
  4. User sees confirmation page

All the user needs to know is that the server did what he told it to. No input other than the button click.

Thanks in advance for your help.


That's what a Form is for. You can create a small HTML form with just the button.

The form's action is the URI to which a request is sent.

Django parse the URI and calls a view function.

The function does the work and returns the resulting page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜