Archive for February, 2009

Django formset factory with arguments

Monday, February 2nd, 2009

So a form in your formset needs some arguments, like the current user, in order to build a ChoiceField or whatever. Sounds pretty common but I couldn't find a built in way to do this. So I created my own formset_factory: [sourcecode language='python'] from django.forms.formsets import BaseFormSet def my_formset_factory(form, formset=BaseFormSet, extra=1, can_order=False, can_delete=False, max_num=0, ...