#29208: Mistake in the documentation, request.POST['username'] is not working,
but
request.POST.get('username') is working!
----------------------------------+--------------------------------------
Reporter: Marat Mkhitaryan | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 2.0
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Claude Paroz):
* status: new => closed
* resolution: => wontfix
Comment:
I wouldn't say this is a bug. The example assumes that request.POST
contains `username` and `password`. If you use that in a context where it
might not be the case, then yes, you should defensively use `.get()`.
That's pure standard Python behaviour.
--
Ticket URL: <https://code.djangoproject.com/ticket/29208#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/073.b0cefb12281afdb75abdc580c468de78%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.