#25683 closed Bug (fixed)
1.8.6 regression: ModelChoiceField no longer accepts Manager objects as queryset
Reported by: | Marti Raudsepp | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.8 |
Severity: | Release blocker | Keywords: | |
Cc: | Tim Graham, marti@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi! It seems that the fix for #25496 caused a regression. When one uses ModelChoiceField(queryset=FooModel.objects)
then it throws:
Traceback (most recent call last): File "/home/marti/workspace/django/tests/forms_tests/tests/tests.py", line 93, in test_modelchoicefield_manager self.assertTrue(list(f.choices)) File "/home/marti/workspace/django/django/forms/models.py", line 1095, in __iter__ method = 'all' if self.queryset._prefetch_related_lookups else 'iterator' AttributeError: 'Manager' object has no attribute '_prefetch_related_lookups'
I have a patch in development to fix this, should be ready soon.
Change History (5)
comment:2 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|
Version 0, edited 9 years ago by (next)
Note:
See TracTickets
for help on using tickets.
Fix for Django master: https://github.com/django/django/pull/5554
Fix for Django 1.8 branch: https://github.com/django/django/pull/5555