Commit Graph

78 Commits

Author SHA1 Message Date
Berker Peksag f7969b0920 Fixed #23620 -- Used more specific assertions in the Django test suite. 2014-11-03 11:56:37 -05:00
Collin Anderson ae7cb992bc Fixed #23721 -- check_related_objects without calling __iter__
Refs #14334
2014-10-28 10:13:50 +02:00
Gabe Jackson 0e16c3e3cd Fixed #23396 -- Ensured ValueQuerySets are not checked by check_related_objects. 2014-10-21 10:02:51 -04:00
Thomas Chaumeny b2aad7b836 Replaced set([foo, ...]) by {foo, ...} literals. Refs PR 3282.
Thanks Collin Anderson for the review.
2014-09-29 00:01:38 +07:00
Matt Robenolt ef5f9b6ae8 Fixed #23460 -- Added literal `%s` support to extra() QuerySets. 2014-09-26 13:01:27 -04:00
Thomas Chaumeny e008a10c2f Fixed #23443 -- Corrected erroneous FieldError message.
Thanks Tim Graham for the review.
2014-09-19 01:01:31 +07:00
Andrew Torpedov bc06d2c11c Fixed #23313 -- Corrected repr(RawQuery) with dict parameters. 2014-08-29 07:22:08 -04:00
Anubhav Joshi cdfdcf4b70 Fixed #23266 -- Prevented queries caused by type checking lookup values
Small modifications done by committer.
2014-08-11 09:51:57 +03:00
Rajiv Makhijani f0b358880a Fixed #23259 -- Corrected insertion order of extra() select_params
A regression caused queries to produce incorrect results for cases where
extra(select) is excluded by values() but included by extra(order_by)

The regression was caused by 2f35c6f10f.
2014-08-11 09:33:18 +03:00
Anubhav Joshi 011abb7d96 Fixed #19671 -- Added warnings that null and validators are ignored for ManyToManyField.
Thanks Loic Bistuer and Tim Graham for help and review.
2014-07-09 16:01:09 -04:00
Anubhav Joshi 34ba86706f Fixed #14334 -- Query relation lookups now check object types.
Thanks rpbarlow for the suggestion; and loic, akaariai, and jorgecarleitao
for reviews.
2014-07-01 06:12:58 -04:00
zsoldosp 7e2c804c94 Split tests.basic.ModelTests in several tests; refs #18586. 2014-06-25 15:39:56 -04:00
Alex Gaynor 1dcc603eff Fixed several typos in Django 2014-05-28 17:39:14 -07:00
Anssi Kääriäinen 3b7c66a3ac Fixed #22466 -- ordering by reverse foreign key
Ordering by reverse foreign key was broken by custom lookups patch
(commit 20bab2cf9d).

Thanks to everybody who helped solving this issue. Special thanks to
Trac alias takis for reporting this.
2014-05-05 15:28:07 +03:00
Anssi Kääriäinen 5e1f4656b9 Fixed #22429 -- Incorrect SQL when using ~Q and F 2014-05-05 13:02:11 +03:00
Alex Gaynor 2bcb8bfc8d Fix many many typos in comments throughout the codebase 2014-04-26 10:18:45 -07:00
Justin Hamade a13df671a5 Fixed #22434 -- Retain ordering on related sliced subqueries.
Thanks maciej.pawlisz for the report, and charettes for the review.
2014-04-16 17:57:11 -04:00
Aymeric Augustin 232181d1c5 Advanced deprecation warnings for 1.8. 2014-03-22 21:12:58 +01:00
Rodolfo Carvalho 0d91225892 Fixed many typos in comments and docstrings.
Thanks Piotr Kasprzyk for help with the patch.
2014-03-03 07:38:09 -05:00
Artur Frysiak faf6a911ad Fixed #22023 -- Raised an error for values() followed by defer() or only().
Previously, doing so resulted in invalid data or crash.

Thanks jtiai for the report and Karol Jochelson,
Jakub Nowak, Loic Bistuer, and Baptiste Mispelon for reviews.
2014-02-17 14:46:13 -05:00
Anssi Kääriäinen 35cecb1ebd Fixed #21748 -- join promotion for negated AND conditions
Made sure Django treats case .filter(NOT (a AND b)) the same way as
.filter((NOT a OR NOT b)) for join promotion.
2014-02-04 18:48:06 +02:00
Anssi Kääriäinen 8b2c1ac06d Added tests for m2m queries with custom pk on the end models
It seems this case was fixed somewhere between 1.5.x and 1.6.x. I added
tests as I wasn't able to find any tests for these cases. Refs #21879
2014-01-28 21:39:15 +02:00
Anssi Kääriäinen 78a2617703 Fixed #21787 -- regression in MTI .exclude() queries 2014-01-24 10:10:17 +02:00
Anssi Kääriäinen 20bab2cf9d Fixed #16187 -- refactored ORM lookup system
Allowed users to specify which lookups or transforms ("nested lookus")
are available for fields. The implementation is now class based.

Squashed commit of the following:

commit fa7a7195f1
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 18 10:53:24 2014 +0200

    Added lookup registration API docs

commit eb1c8ce164
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Tue Jan 14 18:59:36 2014 +0200

    Release notes and other minor docs changes

commit 11501c29c9
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Jan 12 20:53:03 2014 +0200

    Forgot to add custom_lookups tests in prev commit

commit 83173b960e
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Jan 12 19:59:12 2014 +0200

    Renamed Extract -> Transform

commit 3b18d9f3a1
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Jan 12 19:51:53 2014 +0200

    Removed suggestion of temporary lookup registration from docs

commit 21d0c7631c
Merge: 2509006 f2dc442
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Jan 12 09:38:23 2014 -0800

    Merge pull request #2 from mjtamlyn/lookups_3

    Reworked custom lookups docs.

commit f2dc4429a1
Author: Marc Tamlyn <marc.tamlyn@gmail.com>
Date:   Sun Jan 12 13:15:05 2014 +0000

    Reworked custom lookups docs.

    Mostly just formatting and rewording, but also replaced the example
    using ``YearExtract`` to  use an example which is unlikely to ever be
    possible directly in the ORM.

commit 2509006506
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Jan 12 13:19:13 2014 +0200

    Removed unused import

commit 4fba5dfaa0
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 11 22:34:41 2014 +0200

    Added docs to index

commit 6d53963f37
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 11 22:10:24 2014 +0200

    Dead code removal

commit f9cc039007
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 11 19:00:43 2014 +0200

    A new try for docs

commit 33aa18a6e3
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 11 14:57:12 2014 +0200

    Renamed get_cols to get_group_by_cols

commit c7d5f8661b
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 11 14:45:53 2014 +0200

    Altered query string customization for backends vendors

    The new way is trying to call first method 'as_' + connection.vendor.
    If that doesn't exist, then call as_sql().

    Also altered how lookup registration is done. There is now
    RegisterLookupMixin class that is used by Field, Extract and
    sql.Aggregate. This allows one to register lookups for extracts and
    aggregates in the same way lookup registration is done for fields.

commit 90e7004ec1
Merge: 66649ff f7c2c0a
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 11 13:21:01 2014 +0200

    Merge branch 'master' into lookups_3

commit 66649ff891
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 11 13:16:01 2014 +0200

    Some rewording in docs

commit 31b8faa627
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Dec 29 15:52:29 2013 +0200

    Cleanup based on review comments

commit 1016159f34
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Dec 28 18:37:04 2013 +0200

    Proof-of-concept fix for #16731

    Implemented only for SQLite and PostgreSQL, and only for startswith
    and istartswith lookups.

commit 193cd097ca
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Dec 28 17:57:58 2013 +0200

    Fixed #11722 -- iexact=F() produced invalid SQL

commit 08ed3c3b49
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Dec 21 23:59:52 2013 +0200

    Made Lookup and Extract available from django.db.models

commit b99c8d83c9
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Dec 21 23:06:29 2013 +0200

    Fixed review notes by Loic

commit 049eebc070
Merge: ed8fab7 b80a835
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Dec 21 22:53:10 2013 +0200

    Merge branch 'master' into lookups_3

    Conflicts:
    	django/db/models/fields/__init__.py
    	django/db/models/sql/compiler.py
    	django/db/models/sql/query.py
    	tests/null_queries/tests.py

commit ed8fab7fe8
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Dec 21 22:47:23 2013 +0200

    Made Extracts aware of full lookup path

commit 27a57b7aed
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Dec 1 21:10:11 2013 +0200

    Removed debugger import

commit 074e0f5aca
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Dec 1 21:02:16 2013 +0200

    GIS lookup support added

commit 760e28e72b
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Dec 1 20:04:31 2013 +0200

    Removed usage of Constraint, used Lookup instead

commit eac4776684
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Dec 1 02:22:30 2013 +0200

    Minor cleanup of Lookup API

commit 2adf50428d
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Dec 1 02:14:19 2013 +0200

    Added documentation, polished implementation

commit 32c04357a8
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Nov 30 23:10:15 2013 +0200

    Avoid OrderedDict creation on lookup aggregate check

commit 7c8b3a32cc
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Nov 30 23:04:34 2013 +0200

    Implemented nested lookups

    But there is no support of using lookups outside filtering yet.

commit 4d219d4cde
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Wed Nov 27 22:07:30 2013 +0200

    Initial implementation of custom lookups
2014-01-18 11:46:19 +02:00
Baptiste Mispelon f1b3ab9c21 Fixed #11629 -- Deprecated callable arguments to queryset methods.
Callable arguments were an untested and undocumented feature.
2013-12-18 18:40:00 +01:00
Anssi Kääriäinen e7b61e5717 Fixed #11320 -- exclude() too aggressive in join promotion 2013-11-07 12:57:02 +02:00
Anssi Kääriäinen 6fe2b001db Fixed #21376 -- New implementation for query join promotion logic
This commit introduced a new class JoinPromoter that can be used to
abstract away join promotion problems for complex filter conditions.
Query._add_q() and Query.combine() now use the new class.

Also, added a lot of comments about why join promotion is done the way
it is.

Thanks to Tim Graham for original report and testing the changes, and
for Loic Bistuer for review.
2013-11-07 12:53:26 +02:00
Jason Myers c3791463a5 Fixing E302 Errors
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-11-02 23:48:47 -05:00
Anssi Kääriäinen 2a03a9a9a1 Fixed syntax error in queries/tests.py 2013-11-02 22:42:42 +02:00
Anssi Kääriäinen bec0b2a8c6 Fixed #14511 -- bug in .exclude() query 2013-11-02 22:35:45 +02:00
Anssi Kääriäinen b44d42be6d Fixed #21366 -- regression in join promotion logic
The regression was caused by ecaba36028
and affected OR connected filters.
2013-11-02 20:44:19 +02:00
Alex Gaynor 9d740eb8b1 Fix all violators of E231 2013-10-26 12:15:03 -07:00
Alasdair Nicol c3aa2948c6 Fixed #21298 -- Fixed E301 pep8 warnings 2013-10-23 13:45:03 +01:00
Tim Graham ae48d77ef8 Fixed E225 pep8 warnings. 2013-10-23 06:09:29 -04:00
Tim Graham 1597503a01 Fixed E221 pep8 warnings. 2013-10-22 09:51:39 -04:00
Tim Graham 499cd912ca Fixed E227 pep8 warnings 2013-10-21 08:52:21 -04:00
Alasdair Nicol b289fcf1bf Fixed #21288 -- Fixed E126 pep8 warnings 2013-10-21 08:31:30 -04:00
Tim Graham 96d1d4e292 Removed unused local variables in tests. 2013-10-19 08:31:38 -04:00
Alasdair Nicol bab9123daa Fixed #21268 -- Fixed E303 pep8 warnings 2013-10-18 01:46:24 +01:00
Tim Graham b67ab75e82 Fixed assorted flake8 errors. 2013-10-11 07:25:14 -04:00
Anssi Kääriäinen 93cc6dcdac Fixed #18414 -- qs.exists() for sliced distinct queries 2013-10-05 21:40:36 +03:00
Anssi Kääriäinen 068b1e045f Simplified a test by using CapturedQueriesContext 2013-10-05 21:16:09 +03:00
Anssi Kääriäinen ecaba36028 Improved Query join promotion logic
There were multiple cases where join promotion was a bit too aggressive.
This resulted in using outer joins where not necessary.

Refs #21150.
2013-10-05 14:52:17 +03:00
Anssi Kääriäinen bf13c75c0d Fixed #21203 -- resolve_columns fields misalignment
In queries using .defer() together with .select_related() the values
and fields arguments didn't align properly for resolve_columns().
2013-10-01 20:29:23 +03:00
Simon Charette c4fdd859ec Fixed #15786 -- Added a regression test for o2o excludes using F().
The issue was reported against 1.3.x but has been fixed since.
2013-09-29 16:45:03 -04:00
Michael Manfre b0e06c3662 Fixed #21167 - Improved queries.tests.SubqueryTests
Improve tests to cover slicing scenarios that could be handled in unique
ways by 3rd party database backends.
2013-09-29 17:35:42 +03:00
Simon Charette 4ec6d281cd Fixed #21001 -- Added a regression test for empty string exclusion on Oracle.
The issue was present in 1.4.x but has been reported to be fixed in master.

Thanks to @timgraham for the patch.
2013-09-23 14:18:03 -04:00
Aymeric Augustin b4cd8169de Fixed #11811 -- Data-loss bug in queryset.update.
It's now forbidden to call queryset.update(field=instance) when instance
hasn't been saved to the database ie. instance.pk is None.
2013-09-06 17:15:23 -05:00
Tim Graham 5649c0af9d Fixed "indentation is not a multiple of four" pep8 issues. 2013-09-03 14:22:21 -04:00
Anssi Kääriäinen 8d65b6082c Fixed #20955 -- select_related regression
In cases where the same connection (from model A to model B along the
same field) was needed multiple times in a select_related query, the
join setup code mistakenly reused an existing join.
2013-08-22 10:51:07 +03:00