Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Formatting fix for [3248]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3250 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ec23edfc7fd9a7d56e13a861a833cac93a9a7036 1 parent 31eb140
Adrian Holovaty authored July 01, 2006

Showing 1 changed file with 21 additions and 24 deletions. Show diff stats Hide diff stats

  1. 45  django/db/models/query.py
45  django/db/models/query.py
@@ -13,15 +13,12 @@
13 13
 # The string constant used to separate query parts
14 14
 LOOKUP_SEPARATOR = '__'
15 15
 
16  
-# The list of valid query types 
17  
-QUERY_TERMS=(
18  
-    'exact', 'iexact',
19  
-    'contains', 'icontains',
20  
-    'gt', 'gte', 'lt', 'lte',
21  
-    'in',
  16
+# The list of valid query types
  17
+QUERY_TERMS = (
  18
+    'exact', 'iexact', 'contains', 'icontains',
  19
+    'gt', 'gte', 'lt', 'lte', 'in',
22 20
     'startswith', 'istartswith', 'endswith', 'iendswith',
23  
-    'range', 'year', 'month', 'day',
24  
-    'isnull'
  21
+    'range', 'year', 'month', 'day', 'isnull',
25 22
 )
26 23
 
27 24
 # Size of each "chunk" for get_iterator calls.
@@ -216,7 +213,7 @@ def get(self, *args, **kwargs):
216 213
             raise self.model.DoesNotExist, "%s matching query does not exist." % self.model._meta.object_name
217 214
         assert len(obj_list) == 1, "get() returned more than one %s -- it returned %s! Lookup parameters were %s" % (self.model._meta.object_name, len(obj_list), kwargs)
218 215
         return obj_list[0]
219  
-        
  216
+
220 217
     def create(self, **kwargs):
221 218
         """
222 219
         Create a new object with the given kwargs, saving it to the database
@@ -723,7 +720,7 @@ def parse_lookup(kwarg_items, opts):
723 720
             #     a dummy name of None, which we will replace when
724 721
             #     we know which table column to grab as the primary key.
725 722
             # 2)  If there is only one part, or the last part is not a query
726  
-            #     term, assume that the query is an __exact            
  723
+            #     term, assume that the query is an __exact
727 724
             clause = path.pop()
728 725
             if clause == 'pk':
729 726
                 clause = 'exact'
@@ -857,10 +854,10 @@ def lookup_inner(path, clause, value, opts, table, column):
857 854
         # There are elements left in the path. More joins are required.
858 855
         if len(path) == 1 and path[0] in (new_opts.pk.name, None) \
859 856
             and clause in ('exact', 'isnull') and not join_required:
860  
-            # If the next and final name query is for a primary key, 
861  
-            # and the search is for isnull/exact, then the current 
862  
-            # (for N-1) or intermediate (for N-N) table can be used 
863  
-            # for the search - no need to join an extra table just 
  857
+            # If the next and final name query is for a primary key,
  858
+            # and the search is for isnull/exact, then the current
  859
+            # (for N-1) or intermediate (for N-N) table can be used
  860
+            # for the search - no need to join an extra table just
864 861
             # to check the primary key.
865 862
             new_table = current_table
866 863
         else:
@@ -887,15 +884,15 @@ def lookup_inner(path, clause, value, opts, table, column):
887 884
         where.extend(where2)
888 885
         params.extend(params2)
889 886
     else:
890  
-        # No elements left in path. Current element is the element on which 
891  
-        # the search is being performed. 
892  
-        
  887
+        # No elements left in path. Current element is the element on which
  888
+        # the search is being performed.
  889
+
893 890
         if join_required:
894  
-            # Last query term is a RelatedObject 
895  
-            if field.field.rel.multiple:    
  891
+            # Last query term is a RelatedObject
  892
+            if field.field.rel.multiple:
896 893
                 # RelatedObject is from a 1-N relation.
897 894
                 # Join is required; query operates on joined table.
898  
-                column = new_opts.pk.name            
  895
+                column = new_opts.pk.name
899 896
                 joins[backend.quote_name(new_table)] = (
900 897
                     backend.quote_name(new_opts.db_table),
901 898
                     "INNER JOIN",
@@ -907,16 +904,16 @@ def lookup_inner(path, clause, value, opts, table, column):
907 904
                 )
908 905
                 current_table = new_table
909 906
             else:
910  
-                # RelatedObject is from a 1-1 relation, 
911  
-                # No need to join; get the pk value from the related object, 
  907
+                # RelatedObject is from a 1-1 relation,
  908
+                # No need to join; get the pk value from the related object,
912 909
                 # and compare using that.
913 910
                 column = current_opts.pk.name
914  
-        elif intermediate_table: 
  911
+        elif intermediate_table:
915 912
             # Last query term is a related object from an N-N relation.
916 913
             # Join from intermediate table is sufficient.
917 914
             column = join_column
918 915
         elif name == current_opts.pk.name and clause in ('exact', 'isnull') and current_column:
919  
-            # Last query term is for a primary key. If previous iterations 
  916
+            # Last query term is for a primary key. If previous iterations
920 917
             # introduced a current/intermediate table that can be used to
921 918
             # optimize the query, then use that table and column name.
922 919
             column = current_column

0 notes on commit ec23edf

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