- <tsufiev> I have a question regarding https://docs.djangoproject.com/en/1.9/ref/class-based-views/mixins-editing/#django.views.generic.edit.FormMixin.form_invalid
- <badkeypoints> Hi tsufiev
- <badkeypoints> What's the problem?
- <tsufiev> so actually `form` arg is not used anymore in Django 1.9 (although it's still present in signature), instead of passing form it is being constructed from scratch
- that's an unfortunate change for OpenStack Horizon project :(
- <tsufiev> perhaps there is workaround to continue passing `form` into .form_invalid() method as before?
- <tsufiev> some unit tests in our project (as well as its production code) are expecting the validation errors to be placed into `form` instance which is passed to .form_invalid() so the validation errors will be rendered
- <moldy> tsufiev: what exactly do you mean by "`form` arg is not used anymore"?
- tsufiev: can you give an example?
- <moldy> tsufiev: you are talking about form_invalid here?
- <tsufiev> moldy, yes, I'm talking about https://github.com/django/django/blob/1.9/django/views/generic/edit.py#L110
- <tsufiev> the `form` that we pass there is different from the form instance injected into context at https://github.com/django/django/blob/1.9/django/views/generic/edit.py#L121
- <shangxiao> ... interesting
- <moldy> tsufiev: just override the method?
- <tsufiev> moldy, good point, will try to do. Nevertheless, I'm curious if you know the reason for this change?
- <shangxiao> that should be indicated though in the docs
- <shangxiao> seems like a doc bug to me
- <moldy> tsufiev: i am not sure what excactly here has changed
- <tsufiev> moldy, https://github.com/django/django/commit/8a1824d465a551b44376f17c01ef142cc036e863
- <moldy> git blame says: https://github.com/django/django/commit/8a1824d465a551b44376f17c01ef142cc036e863 https://code.djangoproject.com/ticket/24643
- <moldy> at first glance this looks like an accidental change to me, or missing documentation as shangxiao says
- <tsufiev> moldy, thank you for the link, will try to get most sense of it :)
- <moldy> tsufiev: i suggest you open an issue
- <tsufiev> ok
- <moldy> this looks like the ability to override the form when calling form_invalid() was accidentally removed when adding get_context_data, or it was not documented properly. probably nobody thought of your use-case.
- <moldy> not sure if your use-case is "legitimate", but raising an issue will help to clarify it :)
- <tsufiev> moldy, well, the method was not marked as _protected/__private, so I expect the use case to be legitimate :)
- <tsufiev> but I can only guess what was the line of thinking of people who wrote that code 3-4 years ago
- <moldy> tsufiev: maybe it will be argued that the argument was already there because get_context_data was not, but what do i know :p
- <moldy> s/already/only