﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26108	New method for returning OR querysets	Andy Harb	nobody	"It would be nice if you guys created a new method that would allow for OR querysets to be returned.  

Right now you can use <model>.objects.filter() in conjunction with the q() method but this is limiting since you have to have all the ORs in a single filter statement.  If you where to chain another filter statement the two would be ANDed.

It would be helpful to have another method that would OR the chained results together.  This is helpful when you have conditional cases and need to build the queryset up.

Example:
Say i have an object I'm querying and the query looks like this so far:

query = <model>.objects.filter( (Q(id=2) & Q(state=1)) |  (Q(id=3) & (state = 2)) ... )

Now lets say I want to append another OR to the end of the query if the current logged in user is and admin.  Currently I would have to write a conditional statement and duplicate the query in two places except the query with the if user.is_admin would have some additional conditions.

It would be ideal if we could just append another statement with an OR to the current query:
example :   query.include( Q(id=8) & Q(state=3))

This would allow greater flexibility and prevent wet code. 


"	New feature	closed	Database layer (models, ORM)	dev	Normal	wontfix		Anssi Kääriäinen	Someday/Maybe	0	0	0	0	0	0
