#21155: Changing queryset of Model formsets in __init__ doesn't work
-------------------------------+------------------------------------
Reporter: yofee | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.5
Severity: Normal | Keywords: ModelFormSet, queryset
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
In the [
https://docs.djangoproject.com/en/1.5/topics/forms/modelforms /#changing-the-queryset documentation] it says you could change the
queryset of a Model formset by setting it in the `__init__` method:
{{{
class BaseAuthorFormSet(BaseModelFormSet):
def __init__(self, *args, **kwargs):
super(BaseAuthorFormSet, self).__init__(*args, **kwargs)
self.queryset = Author.objects.filter(name__startswith='O')
}}}
But in Django 1.5 it doesn't work. It was fixed in some former versions :
#17478 (Django 1.3) and #11735 (Django 1.1)
--
Ticket URL: <https://code.djangoproject.com/ticket/21155>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.