Commit Graph

72 Commits

Author SHA1 Message Date
Malcolm Tredinnick c4aa26a983 Internal refactoring; moving LOOKUP_SEP up one level.
In an ideal world, nothing except django.db.models.query should have to
import stuff from django.models.sql.*. A few things were needing to get
hold of sql.constants.LOOKUP_SEP, so this commit moves it up to
django.db.models.constants.LOOKUP_SEP.

There are still a couple of places (admin) poking into sql.* to get
QUERY_TERMS, which is unfortunate, but a slightly different issue and
harder to adjust.
2012-09-08 19:51:36 -04:00
Aymeric Augustin 5301a9d7b1 [py3] Removed duplicate imports.
Fixed #18837. Refs #18791.
2012-08-23 10:16:16 +02:00
Alex Gaynor 4c97101b1f remove a bunch of unnescesarry iterkeys() calls 2012-08-08 07:33:15 -07:00
Aymeric Augustin ee191715ea [py3] Fixed access to dict keys/values/items. 2012-08-07 12:00:22 +02:00
Aymeric Augustin ca07fda2ef [py3] Switched to Python 3-compatible imports.
xrange/range will be dealt with in a separate commit due to the huge
number of changes.
2012-07-22 09:29:56 +02:00
Aymeric Augustin 3cb2457f46 [py3] Replaced basestring by six.string_types. 2012-07-22 09:29:54 +02:00
Aymeric Augustin 56dbe924a6 [py3] Removed longs. 2012-07-22 09:29:53 +02:00
Claude Paroz 1aae1cba99 Imported zip from future_builtins instead of itertools.izip.
In Python 3, itertools.izip is not available any more (behaviour
integrated in standard zip).
2012-05-07 17:25:12 +02:00
Alex Gaynor d5a277ba4d Switch a datastructure internal to the ORM to be a set, instead of a dictionary. 2012-04-29 22:18:30 -04:00
Adrian Holovaty 6ff118cdb9 Fixed #17644 -- Changed Query.alias_map to use namedtuples
This makes the code easier to understand and may even have a benefit in memory usage (namedtuples instead of dicts). Thanks, lrekucki and akaariai
2012-04-29 17:50:48 -05:00
Ramiro Morales ae640e5ea0 Fixed #17796 -- Rolled back [17588] because the fix for the original relatively
corner case (boolean fields under MySQL spatial backend) had a wider scope with
potentially unintended consequences affecting the main MySQL backend and the
required changes wouldn't be appropiate at this point of the 1.4 development
cycle.

Refs #15169.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17603 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-29 17:46:23 +00:00
Ramiro Morales 9f6859e1ea Fixed #15169 -- Corrected handling of model boolean fields in MySQL spatial backend.
Thanks goes to zmsmith and others for reporting the issue and to Justin Bronn for the fix.

Refs #7190, r12578, r12900, #13293, r12939.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17588 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-26 14:35:46 +00:00
Carl Meyer 354c84d277 Fixed #17678 -- Corrected setup of _meta.proxy_for_model and added _meta.concrete_model. Thanks Anssi Kääriäinen.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17573 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-22 05:26:50 +00:00
Ramiro Morales d72d5ce827 Fixed #16409 (again, this time for GeoDjango).
Thanks Aymeric Augustin for the regression test and Petr Gorodechnyj for
the patch.

Refs r16522.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17506 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-11 13:50:27 +00:00
Justin Bronn a25413bf86 Fixed #15305 -- Made `Count` aggregate and `.values()` play nice together on `GeoQuerySets`. Thanks, vrehak for the bug report and milosu for initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16797 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-11 00:00:15 +00:00
Justin Bronn 2918c3de74 Fixed #14648 -- Fixed annotated date querysets when `GeoManager` is used. Thanks, codysoyland, for the bug report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16796 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-10 22:53:26 +00:00
Justin Bronn 43329af2e3 Fixed #16408 -- Fixed conversion of dates, and other problems with the SpatiaLite backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16749 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-09 22:34:23 +00:00
Jannis Leidel 24f4764a48 Fixed #16225 -- Removed unused imports. Many thanks to Aymeric Augustin for the work on the patch and Alex for reviewing.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-13 09:35:51 +00:00
Alex Gaynor 21f5dc467e Fixed a bug in date queries with GIS backends introduced in [14715].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14760 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-01 17:53:22 +00:00
Justin Bronn 120aae2209 Enabled area calculations for geography columns.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14189 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-12 17:13:27 +00:00
Justin Bronn 87a60e28cc Fixed #13934 -- `GeoSQLCompiler.get_default_columns` was missing `local_only` keyword argument. Thanks, Simon Law, for bug report and initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13439 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-07-20 19:05:46 +00:00
Justin Bronn 539cfe8cb7 Fixed #8904 -- Improved error message when spatial lookup is not available, and changed exception to `ValueError` to prevent swallowing of error on queryset evaluation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12887 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-30 01:13:47 +00:00
Justin Bronn 7e5265785a Fixed #10594 -- `GeoQuerySet` measurment methods no longer crash on geometry fields with NULL values. Thanks, whiteinge for the bug report and yourcelf for the initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12885 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-29 22:20:38 +00:00
Justin Bronn dc1ad69f30 Fixed #11353 -- `GeometryProxy` descriptor no longer chokes when accessed from a class rather than an instance, thanks yml and Tobu; removed unnecessary imports from `types` and cleaned up whitespace.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12584 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-24 21:20:02 +00:00
Justin Bronn 72c39410c8 Renamed `reverse` to `reverse_geom` because of clash with existing `QuerySet` method; added `GeoQuerySet.geohash` support for producing GeoHash reprsentations.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12350 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-29 02:46:07 +00:00
Justin Bronn 5b21033847 Added `reverse` and `force_rhr` methods to `GeoQuerySet`. Refs #12416.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12349 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-29 02:20:58 +00:00
Justin Bronn ff6b44980a `GeoQuerySet.distance` now allows calculations to/from non-point geodetic geometry fields as allowed on PostGIS 1.5.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12312 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-27 23:09:46 +00:00
Justin Bronn 14acace029 Fixed #12706 -- Forgot to pass `using` kwarg in parent class initialization of `GeoQuerySet`. Thanks, albsen.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12309 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-27 16:24:48 +00:00
Justin Bronn 474ce51ffd Fixed #12690 -- Fixed SQL template used for Oracle's with `SDO_RELATE` function, added `truncate_params` attribute to spatial backend, and re-enabled the `relate` lookup tests. Thanks, jtiai, for the bug report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12300 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-26 17:32:11 +00:00
Justin Bronn 5ec44450df Modified `GeoManager.get_query_set` to reflect changes made for database routing in r12272.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12275 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-22 18:30:23 +00:00
Russell Keith-Magee 1b3dc8ad9a Fixed #12540, #12541 -- Added database routers, allowing for configurable database use behavior in a multi-db setup, and improved error checking for cross-database joins.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12272 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-22 14:30:06 +00:00
Justin Bronn 6b659270d6 Fixed problems associated with the `GeometryField` SRID cache: it is now keyed by the connection alias rather than the spatial backend name (e.g., `spatial_ref_sys` tables may have different entries, even if backend is the same), explicitly pass in connection alias to `SpatialRefSys` query to ensure correct entry is retrieved, and removed unused code from `GeometryField.get_distance`. Thanks, Josh Livni, for the bug report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12258 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-18 21:49:13 +00:00
Justin Bronn 89ded975fe Fixed #12479 -- Pass in connection argument to `as_sql` in `GeoSQLCompiler.get_columns`. Thanks, jpwatts, for bug report and initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12083 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-04 02:37:46 +00:00
Justin Bronn a488589461 Fixed #12344 -- Using `select_related()` on geographic fields with the Oracle spatial backend now works.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12022 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-29 10:18:56 +00:00
Justin Bronn 4ab21fbf40 Fixed `GeoManager.get_query_set` incompatibility with `db_manager` method.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12021 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-29 09:57:37 +00:00
Russell Keith-Magee ff60c5f9de Fixed #1142 -- Added multiple database support.
This monster of a patch is the result of Alex Gaynor's 2009 Google Summer of Code project.
Congratulations to Alex for a job well done.

Big thanks also go to:
 * Justin Bronn for keeping GIS in line with the changes,
 * Karen Tracey and Jani Tiainen for their help testing Oracle support
 * Brett Hoerner, Jon Loyens, and Craig Kimmerer for their feedback.
 * Malcolm Treddinick for his guidance during the GSoC submission process.
 * Simon Willison for driving the original design process
 * Cal Henderson for complaining about ponies he wanted.

... and everyone else too numerous to mention that helped to bring this feature into fruition.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22 15:18:51 +00:00
Karen Tracey 833df0afaa Fixed #12385: Made built-in field type descriptions in admindocs translatable again. Many thanks to Ramiro for the problem report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11878 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-16 18:13:34 +00:00
Karen Tracey 0986a4d2e1 Fixed #7977: Fixed admindocs to use docstrings instead of a static array to locate type information.
Thanks J. Clifford Dyer.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11833 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-12 20:25:41 +00:00
Justin Bronn 32d0730b89 Fixed #11433 -- 3D geometry fields are now supported with PostGIS; EWKB is now used by `PostGISAdaptor`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11742 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-16 18:49:00 +00:00
Justin Bronn 62180a6b44 Fixed #11827: Can now calculate extent in Oracle on tables with one point.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11577 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-09-13 17:40:46 +00:00
Justin Bronn 1707304bad Fixed test cases and `GeoQuerySet.geojson` to support PostGIS 1.4.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11340 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-07-27 04:21:31 +00:00
Justin Bronn 53b8809277 Fixed #11489 -- `GeoQuery.resolve_columns` now recognizes annotations; disabled problematic test cases on Oracle and added notes on why.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11251 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-07-16 22:38:22 +00:00
Justin Bronn 9c5075d125 Forgot to add `collect` to `GeoManager`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11232 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-07-15 02:20:51 +00:00
Justin Bronn 33ea28c2b2 Forgot to add the `collect` GeoQuerySet method to correspond to the `Collect` aggregate object; also added tests for this operation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11227 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-07-11 20:34:27 +00:00
Justin Bronn fdcc0c774a Fixed #11381 -- `GeoManager` + `select_related` + nullable `ForeignKey` now works correctly. Thanks, bretthoerner for ticket and dgouldin for initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11123 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-29 16:31:21 +00:00
Justin Bronn be907bcdcb Fixed #11087 -- Fixed the `Count` annotation when used with `GeoManager`. Thanks to dgouldin for ticket and initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10912 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 04:49:16 +00:00
Justin Bronn 44c062344f Fixed #10888 -- May now insert NULL `GeometryField` values on Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10631 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-24 20:24:50 +00:00
Justin Bronn 037ce4318b Fixed #10839 -- `GeoQuery` now unpickles properly on Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10615 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-21 22:35:04 +00:00
Justin Bronn 4eaf4155f8 Fixed #10836 -- Forgot to move import to to `where` module. Thanks, seanl for ticket & patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10572 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-16 14:16:16 +00:00
Justin Bronn bd8afb1894 Fixed #10807 - `GeoWhereNode` no longer passes `Constraint` objects to where they shouldn't go.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10559 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-14 19:14:32 +00:00