#15198: AuthenticationForm.clean call does not have request set --------------------------------------+------------------------------------ Reporter: Ciantic | Owner: nobody Type: Cleanup/optimization | Status: new Component: contrib.auth | Version: master Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 1 Easy pickings: 1 | UI/UX: 0 --------------------------------------+------------------------------------ Changes (by sven.assmann@…):
* type: New feature => Cleanup/optimization * easy: 0 => 1 Comment: The Problem is not that the authenticate function needs the request. The form has the request parameter already in the contructor. So that your interhited own AuthForm can utilize that. But, the request attribute is not ever set. It is only given on non POST requests. This inconsitency can be solved by patching the auth/views.py login function in that code {{{ if request.method == "POST": form = authentication_form(data=request.POST) if form.is_valid(): }}} has to be changed so {{{ if request.method == "POST": form = authentication_form(data=request.POST, request=request) if form.is_valid(): }}} then it is also conistent to the bottom code in that function where the request is already is given into that form {{{ else: form = authentication_form(request) }}} -- Ticket URL: <https://code.djangoproject.com/ticket/15198#comment:5> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.