Feedback about FormMixin get_context_data()

36 views
Skip to first unread message

Wayne Merry

unread,
Dec 3, 2015, 7:07:20 AM12/3/15
to Django developers (Contributions to Django itself)
Hi all,

Going through the process of scoping upgrading from 1.8 to 1.9 and after having hundreds of test cases failing with "TypeError: get_context_data() missing 1 required positional argument: 'form'" I would just like to make an observation.

It seems like it is a good optimization - as discussed in https://code.djangoproject.com/ticket/24643 to move form init from get()/post() to it's own get_context_data() method for consistency. However this change was not made with any depreciation schedule. The release notes discuss that it may be backward incompatible if methods don't call super(), but it is also incompatible if user derived get_context_data() methods are written presuming that the form has already been instantiated and has form=form as a keyword argument. I'll need to work out the best way of dealing with this, but it would appear that I am going to have to go from 1.8 to 1.9 hard without being able to have code pass tests in both at the same time - unless I introspect the Django version. It would have been better if this change had have gone through a deprecation cycle.

Cheers,
Wayne Merry


Reply all
Reply to author
Forward
0 new messages