Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#10274 closed (fixed)

BaseGenericInlineFormSet.get_queryset calls .empty()

Reported by: Zak Johnson <zakj@…> Owned by: Brian Rosner
Component: Contrib apps Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In BaseGenericInlineFormSet.get_queryset():

        if self.instance is None:
            return self.model._default_manager.empty()

Managers don't have an empty() method; this should instead be get_empty_query_set(). Attached patch (against trunk revision 9836) includes a doctest to illustrate the problem.

Attachments (2)

BaseGenericInlineFormSet.diff (2.0 KB ) - added by Zak Johnson <zakj@…> 15 years ago.
10274-generic-inline-formset-patch-and-test.diff (2.0 KB ) - added by Antti Kaihola 15 years ago.
patch and tests with none() instead of empty()

Download all attachments as: .zip

Change History (6)

by Zak Johnson <zakj@…>, 15 years ago

comment:1 by Brian Rosner, 15 years ago

Owner: changed from nobody to Brian Rosner
Status: newassigned
Triage Stage: UnreviewedAccepted

Wow, that must have been a brain dead commit by me. You are correct empty() is not on a manager, but none() would have been correct here. Thanks for the patch!

comment:2 by Alex Gaynor, 15 years ago

I think what you really want is .none()

by Antti Kaihola, 15 years ago

patch and tests with none() instead of empty()

comment:3 by Brian Rosner, 15 years ago

Resolution: fixed
Status: assignedclosed

(In [9886]) Fixed #10274 -- Fixed an embarrassing mistake in BaseGenericInlineFormSet.get_queryset. Thanks Zak Johnson for the report and akaihola for the patch.

comment:4 by Brian Rosner, 15 years ago

(In [9887]) [1.0.X] Fixed #10274 -- Fixed an embarrassing mistake in BaseGenericInlineFormSet.get_queryset. Thanks Zak Johnson for the report and akaihola for the patch.

Backport of r9886 from trunk.

Note: See TracTickets for help on using tickets.
Back to Top