diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-04-25 15:02:25 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-04-25 15:02:25 +0000 |
| commit | 05e4d51f0d1924efec47c39215d6baf682688fe7 (patch) | |
| tree | 7d92c2387d614787f2f7565baaefc48c44b45f76 /django/db/models/query_utils.py | |
| parent | fcc3648b60c64b8242ddddb84d636e3a6248aee5 (diff) | |
queryset-refactor: Simplify the way filters are passed to the Query class.
This removes a lot of the complexity for handling exclude() calls and results
in more efficient code. I feel a bit stupid for not having spotted this earlier.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7461 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/query_utils.py')
| -rw-r--r-- | django/db/models/query_utils.py | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py index 6f1b860f21..0ce7900c74 100644 --- a/django/db/models/query_utils.py +++ b/django/db/models/query_utils.py @@ -28,10 +28,7 @@ class Q(tree.Node): default = AND def __init__(self, *args, **kwargs): - if args and kwargs: - raise TypeError('Use positional *or* kwargs; not both!') - nodes = list(args) + kwargs.items() - super(Q, self).__init__(children=nodes) + super(Q, self).__init__(children=list(args) + kwargs.items()) def _combine(self, other, conn): if not isinstance(other, Q): @@ -51,6 +48,3 @@ class Q(tree.Node): obj.negate() return obj -def not_q(q): - return ~q - |
