#21964: ProcessFormView should pass **kwargs to get_context_data() --------------------------------------+-------------------- Reporter: cjerdonek | Owner: nobody Type: Cleanup/optimization | Status: new Component: Uncategorized | Version: 1.6 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------------+-------------------- In the `ProcessFormView` class, keyword arguments to the view aren't available in the template context by default.
From what I can tell, changing this behavior (so that one can customize other aspects of the template) requires relying on undocumented implementation details of Django views (namely that `View.as_view()` sets `self.kwargs`). For example: {{{ def get_context_data(self, **kwargs): # ProcessFormView doesn't pass the view's keyword arguments in its # calls to get_context_data(), so we need to add them back manually. context = self.kwargs.copy() context.update(kwargs) return context }}} I think things would be simpler and more consistent if `ProcessFormView` passed the view's `**kwargs` to `get_context_data()` in the first place, in which case `ProcessFormView` could implement its own version of `get_context_data()` that would restrict the context. This would be more DRY by eliminating the need to read `self.kwargs` when overriding `get_context_data()`. This will also reduce potential confusion between the `**kwargs` argument and the undocumented `self.kwargs` attribute. -- Ticket URL: <https://code.djangoproject.com/ticket/21964> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/052.adb8226ee577889418968e96320024c2%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.