﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
11735	Wrong documentation for changing Model formsets queryset	Claude Paroz	nobody	"In the documentation, we can read that a Model Formset queryset can be changed with the following code:
{{{
class BaseAuthorFormSet(BaseModelFormSet):
    def __init__(self, *args, **kwargs):
        self.queryset = Author.objects.filter(name__startswith='O')
        super(BaseAuthorFormSet, self).__init__(*args, **kwargs)
}}}
See http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#changing-the-queryset

This doesn't work. The problem is that in the {{{__init__}}} function of BaseModelFormSet, the queryset is redefined from the queryset parameter which default to None.
See http://code.djangoproject.com/browser/django/trunk/django/forms/models.py#L448

To make it work, the queryset should be added to the {{{__init__}}} call as a keyword parameter. Or it might also be a bug in the {{{__init__}}} function where it should test if self.queryset is not None before assigning to it. Either in docs, either in code, I think there is something to solve. "		closed	Documentation	1.1		fixed			Ready for checkin	1	0	0	0	0	0
