#17795: kwargs not passed on by django.views.generic.edit import ProcessFormView
--------------------------------------+------------------------
     Reporter:  ed.crewe@…            |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  Generic views         |    Version:  1.4-beta-1
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  1                     |      UI/UX:  0
--------------------------------------+------------------------
 Although these do get attached to self.kwargs for use within the class,
 this causes problems for decorators of the get_context_data method.

 kwargs which you may expect to be available for use by decorators you
 create are unset by this mixin.

 NB: In my case this was related to testing user object permissions - hence
 the need to have the context data

 Patching as below fixes it:

     A mixin that processes a form on POST.
     """
     def get(self, request, *args, **kwargs):
         form_class = self.get_form_class()
         form = self.get_form(form_class)
 --      return self.render_to_response(self.get_context_data(form=form))
 ++      kwargs['form'] = form
 ++      return self.render_to_response(self.get_context_data(**kwargs))

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17795>
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.

Reply via email to