Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding notes and starting work on re-implementing the filter api

  • Loading branch information...
commit 54821e4dc0abcb3a7ab400b41557b476dbead775 1 parent 5e8e804
@coleifer authored
Showing with 13 additions and 2 deletions.
  1. +3 −1 TODO.rst
  2. +10 −1 peewee.py
View
4 TODO.rst
@@ -1,8 +1,10 @@
todo
====
+* Q() with django syntax
* inheritance test
* model options test
-* Q() with django syntax
+* topo sort
* backwards compat, esp places where existing api allows strings
+* stronger input validation?
* docs
View
11 peewee.py
@@ -164,6 +164,12 @@ def clone(self):
return Q(self.lhs, self.op, self.rhs, self.negated)
+class DQ(Leaf):
+ def __init__(self, **query):
+ self.query = query
+ super(DQ, self).__init__()
+
+
class Expr(object):
def __init__(self):
self.alias = None
@@ -1222,7 +1228,10 @@ def ensure_join(self, lm, rm, on=None):
query = self.switch(lm).join(rm, on=on).switch(ctx)
return query
- def filter(self, **query):
+ def filter(self, *dq, **query):
+ # plan:
+ # convert **query to a Node w/DQ as leaves
+ # then combine with the *dq and parse that node
node, joins = self.convert_dict_to_node(query)
query = self.clone()
for field in joins:
Please sign in to comment.
Something went wrong with that request. Please try again.