Opened 11 years ago
Closed 11 years ago
#21155 closed Bug (duplicate)
Changing queryset of Model formsets in __init__ doesn't work
Reported by: | yofee | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.5 |
Severity: | Normal | Keywords: | ModelFormSet, queryset |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In the 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)
Note:
See TracTickets
for help on using tickets.
This was fixed in #17478 three months ago (and not backported), that means that this should work in Django 1.6.