1. <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
  2. <badkeypoints> Hi tsufiev
  3. <badkeypoints> What's the problem?
  4. <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
  5. that's an unfortunate change for OpenStack Horizon project :(
  6. <tsufiev> perhaps there is workaround to continue passing `form` into .form_invalid() method as before?
  7. <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
  8. <moldy> tsufiev: what exactly do you mean by "`form` arg is not used anymore"?
  9. tsufiev: can you give an example?
  10. <moldy> tsufiev: you are talking about form_invalid here?
  11. <tsufiev> moldy, yes, I'm talking about https://github.com/django/django/blob/1.9/django/views/generic/edit.py#L110
  12. <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
  13. <shangxiao> ... interesting
  14. <moldy> tsufiev: just override the method?
  15. <tsufiev> moldy, good point, will try to do. Nevertheless, I'm curious if you know the reason for this change?
  16. <shangxiao> that should be indicated though in the docs
  17. <shangxiao> seems like a doc bug to me
  18. <moldy> tsufiev: i am not sure what excactly here has changed
  19. <tsufiev> moldy, https://github.com/django/django/commit/8a1824d465a551b44376f17c01ef142cc036e863
  20. <moldy> git blame says: https://github.com/django/django/commit/8a1824d465a551b44376f17c01ef142cc036e863 https://code.djangoproject.com/ticket/24643
  21. <moldy> at first glance this looks like an accidental change to me, or missing documentation as shangxiao says
  22. <tsufiev> moldy, thank you for the link, will try to get most sense of it :)
  23. <moldy> tsufiev: i suggest you open an issue
  24. <tsufiev> ok
  25. <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.
  26. <moldy> not sure if your use-case is "legitimate", but raising an issue will help to clarify it :)
  27. <tsufiev> moldy, well, the method was not marked as _protected/__private, so I expect the use case to be legitimate :)
  28. <tsufiev> but I can only guess what was the line of thinking of people who wrote that code 3-4 years ago
  29. <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
  30. <moldy> s/already/only