Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Removed trailing whitespace in a few files.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8571 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b016ea0aceb852ad9aac0257706ffc915058084f 1 parent 15ed5e6
Gary Wilson Jr. authored August 26, 2008
30  django/contrib/gis/db/models/fields/__init__.py
@@ -31,7 +31,7 @@ def __init__(self, verbose_name=None, srid=4326, spatial_index=True, dim=2, **kw
31 31
          Indicates whether to create a spatial index.  Defaults to True.
32 32
          Set this instead of 'db_index' for geographic fields since index
33 33
          creation is different for geometry columns.
34  
-                  
  34
+
35 35
         dim:
36 36
          The number of dimensions for this geometry.  Defaults to 2.
37 37
         """
@@ -39,18 +39,18 @@ def __init__(self, verbose_name=None, srid=4326, spatial_index=True, dim=2, **kw
39 39
         # Setting the index flag with the value of the `spatial_index` keyword.
40 40
         self._index = spatial_index
41 41
 
42  
-        # Setting the SRID and getting the units.  Unit information must be 
  42
+        # Setting the SRID and getting the units.  Unit information must be
43 43
         # easily available in the field instance for distance queries.
44 44
         self._srid = srid
45 45
         self._unit, self._unit_name, self._spheroid = get_srid_info(srid)
46 46
 
47 47
         # Setting the dimension of the geometry field.
48 48
         self._dim = dim
49  
-        
50  
-        # Setting the verbose_name keyword argument with the positional 
  49
+
  50
+        # Setting the verbose_name keyword argument with the positional
51 51
         # first parameter, so this works like normal fields.
52 52
         kwargs['verbose_name'] = verbose_name
53  
-       
  53
+
54 54
         super(GeometryField, self).__init__(**kwargs) # Calling the parent initializtion function
55 55
 
56 56
     ### Routines specific to GeometryField ###
@@ -64,7 +64,7 @@ def geodetic(self):
64 64
 
65 65
     def get_distance(self, dist_val, lookup_type):
66 66
         """
67  
-        Returns a distance number in units of the field.  For example, if 
  67
+        Returns a distance number in units of the field.  For example, if
68 68
         `D(km=1)` was passed in and the units of the field were in meters,
69 69
         then 1000 would be returned.
70 70
         """
@@ -84,10 +84,10 @@ def get_distance(self, dist_val, lookup_type):
84 84
         else:
85 85
             # Assuming the distance is in the units of the field.
86 86
             dist_param = dist
87  
-       
  87
+
88 88
         if SpatialBackend.postgis and self.geodetic and lookup_type != 'dwithin' and option == 'spheroid':
89  
-            # On PostGIS, by default `ST_distance_sphere` is used; but if the 
90  
-            # accuracy of `ST_distance_spheroid` is needed than the spheroid 
  89
+            # On PostGIS, by default `ST_distance_sphere` is used; but if the
  90
+            # accuracy of `ST_distance_spheroid` is needed than the spheroid
91 91
             # needs to be passed to the SQL stored procedure.
92 92
             return [gqn(self._spheroid), dist_param]
93 93
         else:
@@ -98,7 +98,7 @@ def get_geometry(self, value):
98 98
         Retrieves the geometry, setting the default SRID from the given
99 99
         lookup parameters.
100 100
         """
101  
-        if isinstance(value, (tuple, list)): 
  101
+        if isinstance(value, (tuple, list)):
102 102
             geom = value[0]
103 103
         else:
104 104
             geom = value
@@ -117,7 +117,7 @@ def get_geometry(self, value):
117 117
 
118 118
         # Assigning the SRID value.
119 119
         geom.srid = self.get_srid(geom)
120  
-        
  120
+
121 121
         return geom
122 122
 
123 123
     def get_srid(self, geom):
@@ -135,12 +135,12 @@ def get_srid(self, geom):
135 135
     ### Routines overloaded from Field ###
136 136
     def contribute_to_class(self, cls, name):
137 137
         super(GeometryField, self).contribute_to_class(cls, name)
138  
-        
  138
+
139 139
         # Setup for lazy-instantiated Geometry object.
140 140
         setattr(cls, self.attname, GeometryProxy(SpatialBackend.Geometry, self))
141 141
 
142 142
     def formfield(self, **kwargs):
143  
-        defaults = {'form_class' : forms.GeometryField, 
  143
+        defaults = {'form_class' : forms.GeometryField,
144 144
                     'geom_type' : self._geom,
145 145
                     'null' : self.null,
146 146
                     }
@@ -161,8 +161,8 @@ def get_db_prep_lookup(self, lookup_type, value):
161 161
             # if it is None.
162 162
             geom = self.get_geometry(value)
163 163
 
164  
-            # Getting the WHERE clause list and the associated params list. The params 
165  
-            # list is populated with the Adaptor wrapping the Geometry for the 
  164
+            # Getting the WHERE clause list and the associated params list. The params
  165
+            # list is populated with the Adaptor wrapping the Geometry for the
166 166
             # backend.  The WHERE clause list contains the placeholder for the adaptor
167 167
             # (e.g. any transformation SQL).
168 168
             where = [self.get_placeholder(geom)]
18  django/db/models/fields/related.py
@@ -44,7 +44,7 @@ class MyModel(Model):
@@ -378,7 +378,7 @@ def __init__(self, model=None, core_filters=None, instance=None, symmetrical=Non
@@ -773,7 +773,7 @@ def __init__(self, to, **kwargs):
@@ -817,7 +817,7 @@ def _get_m2m_column_name(self, related):
@@ -831,8 +831,8 @@ def _get_m2m_reverse_name(self, related):
@@ -884,13 +884,13 @@ def flatten_data(self, follow, obj = None):
@@ -900,7 +900,7 @@ def resolve_through_model(field, model, cls):
26  tests/modeltests/m2m_through/models.py
@@ -7,7 +7,7 @@ class Person(models.Model):
7 7
 
8 8
     class Meta:
9 9
         ordering = ('name',)
10  
-        
  10
+
11 11
     def __unicode__(self):
12 12
         return self.name
13 13
 
@@ -19,7 +19,7 @@ class Group(models.Model):
19 19
 
20 20
     class Meta:
21 21
         ordering = ('name',)
22  
-            
  22
+
23 23
     def __unicode__(self):
24 24
         return self.name
25 25
 
@@ -31,7 +31,7 @@ class Membership(models.Model):
31 31
 
32 32
     class Meta:
33 33
         ordering = ('date_joined', 'invite_reason', 'group')
34  
-    
  34
+
35 35
     def __unicode__(self):
36 36
         return "%s is a member of %s" % (self.person.name, self.group.name)
37 37
 
@@ -40,10 +40,10 @@ class CustomMembership(models.Model):
40 40
     group = models.ForeignKey(Group)
41 41
     weird_fk = models.ForeignKey(Membership, null=True)
42 42
     date_joined = models.DateTimeField(default=datetime.now)
43  
-    
  43
+
44 44
     def __unicode__(self):
45 45
         return "%s is a member of %s" % (self.person.name, self.group.name)
46  
-    
  46
+
47 47
     class Meta:
48 48
         db_table = "test_table"
49 49
 
@@ -55,7 +55,7 @@ class TestNoDefaultsOrNulls(models.Model):
55 55
 class PersonSelfRefM2M(models.Model):
56 56
     name = models.CharField(max_length=5)
57 57
     friends = models.ManyToManyField('self', through="Friendship", symmetrical=False)
58  
-    
  58
+
59 59
     def __unicode__(self):
60 60
         return self.name
61 61
 
@@ -98,7 +98,7 @@ class Friendship(models.Model):
98 98
 >>> jim.group_set.all()
99 99
 [<Group: Rock>, <Group: Roll>]
100 100
 
101  
-# Querying the intermediary model works like normal.  
  101
+# Querying the intermediary model works like normal.
102 102
 # In this case we get Jane's membership to Rock.
103 103
 >>> m = Membership.objects.get(person=jane, group=rock)
104 104
 >>> m
@@ -122,7 +122,7 @@ class Friendship(models.Model):
122 122
 
123 123
 ### Forward Descriptors Tests ###
124 124
 
125  
-# Due to complications with adding via an intermediary model, 
  125
+# Due to complications with adding via an intermediary model,
126 126
 # the add method is not provided.
127 127
 >>> rock.members.add(bob)
128 128
 Traceback (most recent call last):
@@ -173,7 +173,7 @@ class Friendship(models.Model):
173 173
 
174 174
 ### Reverse Descriptors Tests ###
175 175
 
176  
-# Due to complications with adding via an intermediary model, 
  176
+# Due to complications with adding via an intermediary model,
177 177
 # the add method is not provided.
178 178
 >>> bob.group_set.add(rock)
179 179
 Traceback (most recent call last):
@@ -287,7 +287,7 @@ class Friendship(models.Model):
287 287
 
288 288
 ### QUERY TESTS ###
289 289
 
290  
-# We can query for the related model by using its attribute name (members, in 
  290
+# We can query for the related model by using its attribute name (members, in
291 291
 # this case).
292 292
 >>> Group.objects.filter(members__name='Bob')
293 293
 [<Group: Roll>]
@@ -315,19 +315,19 @@ class Friendship(models.Model):
315 315
 >>> Group.objects.filter(membership__date_joined__gt=datetime(2005, 1, 1), membership__person =jane)
316 316
 [<Group: Rock>]
317 317
 
318  
-# Queries also work in the reverse direction: Now let's see all of the people 
  318
+# Queries also work in the reverse direction: Now let's see all of the people
319 319
 # that have joined Rock since 1 Jan 2005:
320 320
 >>> Person.objects.filter(membership__date_joined__gt=datetime(2005, 1, 1), membership__group=rock)
321 321
 [<Person: Jane>, <Person: Jim>]
322 322
 
323 323
 # Conceivably, queries through membership could return correct, but non-unique
324  
-# querysets.  To demonstrate this, we query for all people who have joined a 
  324
+# querysets.  To demonstrate this, we query for all people who have joined a
325 325
 # group after 2004:
326 326
 >>> Person.objects.filter(membership__date_joined__gt=datetime(2004, 1, 1))
327 327
 [<Person: Jane>, <Person: Jim>, <Person: Jim>]
328 328
 
329 329
 # Jim showed up twice, because he joined two groups ('Rock', and 'Roll'):
330  
->>> [(m.person.name, m.group.name) for m in 
  330
+>>> [(m.person.name, m.group.name) for m in
331 331
 ... Membership.objects.filter(date_joined__gt=datetime(2004, 1, 1))]
332 332
 [(u'Jane', u'Rock'), (u'Jim', u'Rock'), (u'Jim', u'Roll')]
333 333
 

0 notes on commit b016ea0

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