Initial data and addition queryset_filter for formset from inlineformset_factory
|Reported by:||ramusus||Owned by:||nobody|
|Cc:||ramusus@…, sehmaschine@…||Triage Stage:||Unreviewed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||no|
To the continue of the discussion here: http://groups.google.ru/group/django-developers/browse_thread/thread/73af9e58bd7626a8/e307d4865759a26e
I also need the ability to define initial data for formset from inlineformset_factory. It's very strange to limit this by the framework for inlineformset_factory, but not limit for modelformset_factory.
Queryset parameter created automatically inside inlineformset_factory, but I can imagine situation, when it's necessary to generate form and formset with not all linked objects. For example If I need to see formset with instances, filtered by special condition, based on fields. For this purpose I added queryset_filter parameter, that passed as a kwargs argument into queryset.filter(queryset_filter).
Formsets is a great mechanism, that simplify many routine operations with linked objects. I think it's better to have ability tune this mecanism in detail.
Change History (12)
comment:1 Changed 7 years ago by
|Patch needs improvement:||unset|
comment:10 Changed 5 years ago by