Changes between Version 20 and Version 21 of NewbieMistakes
- Timestamp:
- Jun 7, 2006, 10:49:20 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
NewbieMistakes
v20 v21 1 = Newbie Mistakes =1 = Newbie mistakes = 2 2 3 3 Please feel free to share the things that tripped you up when you started with Django. We'll try to improve Django's error handling to catch such mistakes in the future. … … 7 7 ==== Symptom ==== 8 8 9 You are having a form that does a POST to some viewand the view doesn't get the POST data from the form.9 You've got a form that does a POST to some view, and the view doesn't get the POST data from the form. 10 10 11 11 ==== Probable cause ==== 12 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 always 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 gets lost. 13 You might be missing the / at the end of the form {{{action}}}. If that's the case, the {{{CommonMiddleware}}} (check your {{{MIDDLEWARE_CLASSES}}} redirects to the exact name of the view - and that always includes a trailing slash. Because it does so by using the standard HTTP redirection through Location header, it can't pass on the POST data - and that's why it gets lost. 16 14 17 15 ==== Solution ==== 18 16 19 Al lways make sure that your form actions end with /like this:17 Always make sure that your form actions end with a slash, like this: 20 18 21 19 {{{ … … 25 23 </form> 26 24 }}} 25 26 Note that Django now attempts to catch this problem, as of [3109]. 27 27 28 28