Author: Alex
Date: 2010-06-22 13:08:47 -0500 (Tue, 22 Jun 2010)
New Revision: 13381

Modified:
   django/branches/soc2010/query-refactor/django/contrib/mongodb/compiler.py
   django/branches/soc2010/query-refactor/tests/regressiontests/mongodb/tests.py
Log:
[soc2010/query-refactor] Implemented __gt.

Modified: 
django/branches/soc2010/query-refactor/django/contrib/mongodb/compiler.py
===================================================================
--- django/branches/soc2010/query-refactor/django/contrib/mongodb/compiler.py   
2010-06-22 18:08:38 UTC (rev 13380)
+++ django/branches/soc2010/query-refactor/django/contrib/mongodb/compiler.py   
2010-06-22 18:08:47 UTC (rev 13381)
@@ -9,6 +9,7 @@
         "exact": lambda params, value_annotation, negated: params[0],
         "lt": lambda params, value_annotation, negated: {"$lt": params[0]},
         "isnull": lambda params, value_annotation, negated: {"$ne": None} if 
value_annotation == negated else None,
+        "gt": lambda params, value_annotation, negated: {"$gt": params[0]},
     }
     
     def __init__(self, query, connection, using):

Modified: 
django/branches/soc2010/query-refactor/tests/regressiontests/mongodb/tests.py
===================================================================
--- 
django/branches/soc2010/query-refactor/tests/regressiontests/mongodb/tests.py   
    2010-06-22 18:08:38 UTC (rev 13380)
+++ 
django/branches/soc2010/query-refactor/tests/regressiontests/mongodb/tests.py   
    2010-06-22 18:08:47 UTC (rev 13381)
@@ -224,3 +224,35 @@
             ],
             lambda g: g.name
         )
+    
+    def test_gt(self):
+        q = Group.objects.create(name="Queen", year_formed=1971)
+        e = Group.objects.create(name="The E Street Band", year_formed=1972)
+        
+        self.assertQuerysetEqual(
+            Group.objects.filter(year_formed__gt=1970), [
+                "Queen",
+                "The E Street Band",
+            ],
+            lambda g: g.name
+        )
+        
+        self.assertQuerysetEqual(
+            Group.objects.filter(year_formed__gt=1971), [
+                "The E Street Band",
+            ],
+            lambda g: g.name
+        )
+        
+        self.assertQuerysetEqual(
+            Group.objects.filter(year_formed__gt=1972),
+            [],
+            lambda g: g.name
+        )
+        
+        self.assertQuerysetEqual(
+            Group.objects.exclude(year_formed__gt=1971), [
+                "Queen",
+            ],
+            lambda g: g.name,
+        )

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to