user456584
user456584

Reputation: 88815

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. 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.

Upvotes: 1

Views: 918

Answers (1)

S.Lott
S.Lott

Reputation: 391848

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.

Upvotes: 4

Related Questions