Changed how GenericReferenceFields are stored / queried

This commit is contained in:
Harry Marr
2010-02-28 23:15:21 +00:00
parent 81dd5adccf
commit 95a7b33fb4
4 changed files with 44 additions and 31 deletions

View File

@@ -322,6 +322,9 @@ class QuerySet(object):
# 'in', 'nin' and 'all' require a list of values
value = [field.prepare_query_value(op, v) for v in value]
if field.__class__.__name__ == 'GenericReferenceField':
parts.append('_ref')
if op and op not in match_operators:
value = {'$' + op: value}