Loading django/contrib/admin/options.py +2 −2 Original line number Diff line number Diff line Loading @@ -253,7 +253,7 @@ class BaseModelAdmin(six.with_metaclass(forms.MediaDefiningClass)): }) kwargs['empty_label'] = _('None') if db_field.blank else None if not 'queryset' in kwargs: if 'queryset' not in kwargs: queryset = self.get_field_queryset(db, db_field, request) if queryset is not None: kwargs['queryset'] = queryset Loading @@ -277,7 +277,7 @@ class BaseModelAdmin(six.with_metaclass(forms.MediaDefiningClass)): elif db_field.name in (list(self.filter_vertical) + list(self.filter_horizontal)): kwargs['widget'] = widgets.FilteredSelectMultiple(db_field.verbose_name, (db_field.name in self.filter_vertical)) if not 'queryset' in kwargs: if 'queryset' not in kwargs: queryset = self.get_field_queryset(db, db_field, request) if queryset is not None: kwargs['queryset'] = queryset Loading django/contrib/admin/validation.py +1 −1 Original line number Diff line number Diff line Loading @@ -138,7 +138,7 @@ class BaseValidator(object): raise ImproperlyConfigured("'%s.radio_fields['%s']' " "is neither an instance of ForeignKey nor does " "have choices set." % (cls.__name__, field)) if not val in (HORIZONTAL, VERTICAL): if val not in (HORIZONTAL, VERTICAL): raise ImproperlyConfigured("'%s.radio_fields['%s']' " "is neither admin.HORIZONTAL nor admin.VERTICAL." % (cls.__name__, field)) Loading django/contrib/gis/db/backends/postgis/operations.py +2 −2 Original line number Diff line number Diff line Loading @@ -481,14 +481,14 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations): geo_col, db_type = lvalue if lookup_type in self.geometry_operators: if field.geography and not lookup_type in self.geography_operators: if field.geography and lookup_type not in self.geography_operators: raise ValueError('PostGIS geography does not support the ' '"%s" lookup.' % lookup_type) # Handling a PostGIS operator. op = self.geometry_operators[lookup_type] return op.as_sql(geo_col, self.get_geom_placeholder(field, value)) elif lookup_type in self.geometry_functions: if field.geography and not lookup_type in self.geography_functions: if field.geography and lookup_type not in self.geography_functions: raise ValueError('PostGIS geography type does not support the ' '"%s" lookup.' % lookup_type) Loading django/contrib/gis/db/models/fields.py +3 −3 Original line number Diff line number Diff line Loading @@ -29,11 +29,11 @@ def get_srid_info(srid, connection): # No `spatial_ref_sys` table in spatial backend (e.g., MySQL). return None, None, None if not connection.alias in _srid_cache: if connection.alias not in _srid_cache: # Initialize SRID dictionary for database if it doesn't exist. _srid_cache[connection.alias] = {} if not srid in _srid_cache[connection.alias]: if srid not in _srid_cache[connection.alias]: # Use `SpatialRefSys` model to query for spatial reference info. sr = SpatialRefSys.objects.using(connection.alias).get(srid=srid) units, units_name = sr.units Loading Loading @@ -225,7 +225,7 @@ class GeometryField(Field): 'srid': self.srid, } defaults.update(kwargs) if (self.dim > 2 and not 'widget' in kwargs and if (self.dim > 2 and 'widget' not in kwargs and not getattr(defaults['form_class'].widget, 'supports_3d', False)): defaults['widget'] = forms.Textarea return super(GeometryField, self).formfield(**defaults) Loading django/contrib/gis/db/models/query.py +4 −4 Original line number Diff line number Diff line Loading @@ -467,7 +467,7 @@ class GeoQuerySet(QuerySet): # If the `geo_field_type` keyword was used, then enforce that # type limitation. if not geo_field_type is None and not isinstance(geo_field, geo_field_type): if geo_field_type is not None and not isinstance(geo_field, geo_field_type): raise TypeError('"%s" stored procedures may only be called on %ss.' % (func, geo_field_type.__name__)) # Setting the procedure args. Loading @@ -488,7 +488,7 @@ class GeoQuerySet(QuerySet): # Checking if there are any geo field type limitations on this # aggregate (e.g. ST_Makeline only operates on PointFields). if not geo_field_type is None and not isinstance(geo_field, geo_field_type): if geo_field_type is not None and not isinstance(geo_field, geo_field_type): raise TypeError('%s aggregate may only be called on %ss.' % (aggregate.name, geo_field_type.__name__)) # Getting the string expression of the field name, as this is the Loading Loading @@ -766,7 +766,7 @@ class GeoQuerySet(QuerySet): ForeignKey relation to the current model. """ opts = self.model._meta if not geo_field in opts.fields: if geo_field not in opts.fields: # Is this operation going to be on a related geographic field? # If so, it'll have to be added to the select related information # (e.g., if 'location__point' was given as the field name). Loading @@ -777,7 +777,7 @@ class GeoQuerySet(QuerySet): if field == geo_field: return compiler._field_column(geo_field, rel_table) raise ValueError("%r not in self.query.related_select_cols" % geo_field) elif not geo_field in opts.local_fields: elif geo_field not in opts.local_fields: # This geographic field is inherited from another model, so we have to # use the db table for the _parent_ model instead. tmp_fld, parent_model, direct, m2m = opts.get_field_by_name(geo_field.name) Loading Loading
django/contrib/admin/options.py +2 −2 Original line number Diff line number Diff line Loading @@ -253,7 +253,7 @@ class BaseModelAdmin(six.with_metaclass(forms.MediaDefiningClass)): }) kwargs['empty_label'] = _('None') if db_field.blank else None if not 'queryset' in kwargs: if 'queryset' not in kwargs: queryset = self.get_field_queryset(db, db_field, request) if queryset is not None: kwargs['queryset'] = queryset Loading @@ -277,7 +277,7 @@ class BaseModelAdmin(six.with_metaclass(forms.MediaDefiningClass)): elif db_field.name in (list(self.filter_vertical) + list(self.filter_horizontal)): kwargs['widget'] = widgets.FilteredSelectMultiple(db_field.verbose_name, (db_field.name in self.filter_vertical)) if not 'queryset' in kwargs: if 'queryset' not in kwargs: queryset = self.get_field_queryset(db, db_field, request) if queryset is not None: kwargs['queryset'] = queryset Loading
django/contrib/admin/validation.py +1 −1 Original line number Diff line number Diff line Loading @@ -138,7 +138,7 @@ class BaseValidator(object): raise ImproperlyConfigured("'%s.radio_fields['%s']' " "is neither an instance of ForeignKey nor does " "have choices set." % (cls.__name__, field)) if not val in (HORIZONTAL, VERTICAL): if val not in (HORIZONTAL, VERTICAL): raise ImproperlyConfigured("'%s.radio_fields['%s']' " "is neither admin.HORIZONTAL nor admin.VERTICAL." % (cls.__name__, field)) Loading
django/contrib/gis/db/backends/postgis/operations.py +2 −2 Original line number Diff line number Diff line Loading @@ -481,14 +481,14 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations): geo_col, db_type = lvalue if lookup_type in self.geometry_operators: if field.geography and not lookup_type in self.geography_operators: if field.geography and lookup_type not in self.geography_operators: raise ValueError('PostGIS geography does not support the ' '"%s" lookup.' % lookup_type) # Handling a PostGIS operator. op = self.geometry_operators[lookup_type] return op.as_sql(geo_col, self.get_geom_placeholder(field, value)) elif lookup_type in self.geometry_functions: if field.geography and not lookup_type in self.geography_functions: if field.geography and lookup_type not in self.geography_functions: raise ValueError('PostGIS geography type does not support the ' '"%s" lookup.' % lookup_type) Loading
django/contrib/gis/db/models/fields.py +3 −3 Original line number Diff line number Diff line Loading @@ -29,11 +29,11 @@ def get_srid_info(srid, connection): # No `spatial_ref_sys` table in spatial backend (e.g., MySQL). return None, None, None if not connection.alias in _srid_cache: if connection.alias not in _srid_cache: # Initialize SRID dictionary for database if it doesn't exist. _srid_cache[connection.alias] = {} if not srid in _srid_cache[connection.alias]: if srid not in _srid_cache[connection.alias]: # Use `SpatialRefSys` model to query for spatial reference info. sr = SpatialRefSys.objects.using(connection.alias).get(srid=srid) units, units_name = sr.units Loading Loading @@ -225,7 +225,7 @@ class GeometryField(Field): 'srid': self.srid, } defaults.update(kwargs) if (self.dim > 2 and not 'widget' in kwargs and if (self.dim > 2 and 'widget' not in kwargs and not getattr(defaults['form_class'].widget, 'supports_3d', False)): defaults['widget'] = forms.Textarea return super(GeometryField, self).formfield(**defaults) Loading
django/contrib/gis/db/models/query.py +4 −4 Original line number Diff line number Diff line Loading @@ -467,7 +467,7 @@ class GeoQuerySet(QuerySet): # If the `geo_field_type` keyword was used, then enforce that # type limitation. if not geo_field_type is None and not isinstance(geo_field, geo_field_type): if geo_field_type is not None and not isinstance(geo_field, geo_field_type): raise TypeError('"%s" stored procedures may only be called on %ss.' % (func, geo_field_type.__name__)) # Setting the procedure args. Loading @@ -488,7 +488,7 @@ class GeoQuerySet(QuerySet): # Checking if there are any geo field type limitations on this # aggregate (e.g. ST_Makeline only operates on PointFields). if not geo_field_type is None and not isinstance(geo_field, geo_field_type): if geo_field_type is not None and not isinstance(geo_field, geo_field_type): raise TypeError('%s aggregate may only be called on %ss.' % (aggregate.name, geo_field_type.__name__)) # Getting the string expression of the field name, as this is the Loading Loading @@ -766,7 +766,7 @@ class GeoQuerySet(QuerySet): ForeignKey relation to the current model. """ opts = self.model._meta if not geo_field in opts.fields: if geo_field not in opts.fields: # Is this operation going to be on a related geographic field? # If so, it'll have to be added to the select related information # (e.g., if 'location__point' was given as the field name). Loading @@ -777,7 +777,7 @@ class GeoQuerySet(QuerySet): if field == geo_field: return compiler._field_column(geo_field, rel_table) raise ValueError("%r not in self.query.related_select_cols" % geo_field) elif not geo_field in opts.local_fields: elif geo_field not in opts.local_fields: # This geographic field is inherited from another model, so we have to # use the db table for the _parent_ model instead. tmp_fld, parent_model, direct, m2m = opts.get_field_by_name(geo_field.name) Loading