Thursday, September 29, 2016

Discussing the documentation on formset.get_form_kwargs()

https://docs.djangoproject.com/en/1.10/topics/forms/formsets/#passing-custom-parameters-to-formset-forms

In the documentation there is a sentence "The formset base class provides a get_form_kwargs method." 

Could you help me understand why this sentence should be illustrated with the exmple of redefinition of this method.

Then I would say this is an example of side effect in programming: it gives unpredictable result. If the form is called get_form_kwargs, then we expect that it returns what kwargs are present in the form. But this method disfigures the picture.
Well, side effect in its classical meaning (https://en.wikipedia.org/wiki/Side_effect_(computer_science))

Wouldn't just formset.get_form_kwargs(0)  be better here?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/05d9ba91-918e-483d-8c14-453a514dfece%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment