﻿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
22531	Q objects lack a useful repr	Keryn Knight <django@…>	nobody	"{{{
>>> from django.db.models.query_utils import Q
>>> a = Q()
>>> b = Q(a=1, b=2)
>>> c = b & Q(c=3)
>>> d = c | Q(d=4)
>>> e = Q(d) & Q(e=5)
>>> f = e | ~Q(f=6)
>>> repr(f)  # actually just typing f<enter> into ipython/pdb/python REPL
'<django.db.models.query_utils.Q at 0x103184050>'
}}}
That's not exactly useful, given a Q object may represent a complex tree. As it turns out, Q objects '''do''' implement str, which is the SQL output for the Node subclass, which would be more useful than the above repr, and possibly more useful than the nested repr of .children

The simplest repr implementation would probably be something like:

{{{
def __repr__(self):
    return '{obj.__class__!r} {obj!s}'.format(obj=self)
}}}"	New feature	closed	Database layer (models, ORM)	dev	Normal	fixed			Accepted	0	0	0	0	0	0
