Code

Opened 7 years ago

Closed 7 years ago

#3276 closed defect (invalid)

__in lookup broken within exclude()

Reported by: anonymous Owned by: adrian
Component: Database layer (models, ORM) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

This doesn't seem right:

this works OK:

In [11]: qset.exclude( id__in=list(range(10) ) ).count()
Out[11]: 44L

this is what's wrong:

In [12]: len( list( qset.exclude( id__in=list(range(10) ) ) ) )
Out[12]: 2288

the actual data from DB is repeated over and over 52times...
even when I iterate over it in a template...

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by anonymous

  • Resolution set to invalid
  • Status changed from new to closed

sorry guys, mistake on my side:

I had related_table.column specified in Meta.ordering - that worked fine, until I removed my custom manager that appended select_related() to the default queryset, therefore it resulted in a cross join...

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.