Hi all, I've quite often found myself needing to pass custom kwargs to each form within a formset (common parameter for all forms). A common pattern for this is implementing a custom BaseMyModelFormSet(BaseModelFormSet), overriding __init__ and then passing the custom argument via _construct_form, hereby overriding/extending a private method.
Would it be a good idea to add a form_kwargs attribute on the BaseFormSet class, and pass those arguments by default within _construct_form? This would reduce code verbosity so that you only need to set form_kwargs, either on class definition of the custom BaseFormSet, or dynamically in the custom formset class' __init__. This would prevent overriding a private method. An alternative approach is using functools' partial/curry, but apparently this may cause trouble with the order of arguments and passing dynamic values (such as request.user). I'd love to hear any feedback on this, if other people like it I might give the implementation a go on the Djangocon EU sprint. -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/8011c21f-8384-4ef7-93bf-1e1f01769d47%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.