Skip to content
This repository
Browse code

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

  • Loading branch information...
commit 54821e4dc0abcb3a7ab400b41557b476dbead775 1 parent 5e8e804
Charles Leifer authored

Showing 2 changed files with 13 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  TODO.rst
  2. 11  peewee.py
4  TODO.rst
Source Rendered
... ...
@@ -1,8 +1,10 @@
1 1
 todo
2 2
 ====
3 3
 
  4
+* Q() with django syntax
4 5
 * inheritance test
5 6
 * model options test
6  
-* Q() with django syntax
  7
+* topo sort
7 8
 * backwards compat, esp places where existing api allows strings
  9
+* stronger input validation?
8 10
 * docs
11  peewee.py
@@ -164,6 +164,12 @@ def clone(self):
164 164
         return Q(self.lhs, self.op, self.rhs, self.negated)
165 165
 
166 166
 
  167
+class DQ(Leaf):
  168
+    def __init__(self, **query):
  169
+        self.query = query
  170
+        super(DQ, self).__init__()
  171
+
  172
+
167 173
 class Expr(object):
168 174
     def __init__(self):
169 175
         self.alias = None
@@ -1222,7 +1228,10 @@ def ensure_join(self, lm, rm, on=None):
1222 1228
         query = self.switch(lm).join(rm, on=on).switch(ctx)
1223 1229
         return query
1224 1230
 
1225  
-    def filter(self, **query):
  1231
+    def filter(self, *dq, **query):
  1232
+        # plan:
  1233
+        # convert **query to a Node w/DQ as leaves
  1234
+        # then combine with the *dq and parse that node
1226 1235
         node, joins = self.convert_dict_to_node(query)
1227 1236
         query = self.clone()
1228 1237
         for field in joins:

0 notes on commit 54821e4

Please sign in to comment.
Something went wrong with that request. Please try again.