| | 4 | |
| | 5 | == POST to views loses POST data == |
| | 6 | |
| | 7 | ==== Symptom ==== |
| | 8 | |
| | 9 | You are having a form that does a POST to some view and the view doesn't get the POST data from the form. |
| | 10 | |
| | 11 | ==== Probable cause ==== |
| | 12 | |
| | 13 | You might missing the / at the end of the form action. If that is the case, the CommonMiddleware redirects |
| | 14 | to the exact name of the view - and that allways includes a trailing /. Because it does so by using the |
| | 15 | standard HTTP redirection through Location header, it can't pass on the POST data - and that's why it get's lost. |
| | 16 | |
| | 17 | ==== Solution ==== |
| | 18 | |
| | 19 | Allways make sure that your form actions end with / like this: |
| | 20 | |
| | 21 | {{{ |
| | 22 | <form action="/registration/login/" method="POST"> |
| | 23 | <input name="username"> |
| | 24 | <input name="password" type="password"> |
| | 25 | </form> |
| | 26 | }}} |
| | 27 | |