[Django] #21155: Changing queryset of Model formsets in __init__ doesn't work

5 views
Skip to first unread message

Django

unread,
Sep 24, 2013, 4:02:30 PM9/24/13
to django-...@googlegroups.com
#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.

Django

unread,
Sep 25, 2013, 2:45:15 AM9/25/13
to django-...@googlegroups.com
#21155: Changing queryset of Model formsets in __init__ doesn't work
-------------------------------------+-------------------------------------
Reporter: yofee | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 1.5
Severity: Normal | Resolution: duplicate
Keywords: ModelFormSet, | Triage Stage:
queryset | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* status: new => closed
* needs_better_patch: => 0
* resolution: => duplicate
* needs_tests: => 0
* needs_docs: => 0


Comment:

This was fixed in #17478 three months ago (and not backported), that means
that this should work in Django 1.6.

--
Ticket URL: <https://code.djangoproject.com/ticket/21155#comment:1>

Reply all
Reply to author
Forward
0 new messages