1
0
mirror of https://github.com/django/django.git synced 2024-11-18 07:26:04 +00:00
Commit Graph

52 Commits

Author SHA1 Message Date
Flávio Juvenal
e1f13f1551 Fixed #29320 -- Added an exception when an annotation alias matches a ForeignKey attname. 2018-04-12 21:15:40 -04:00
Jon Dufresne
3187c89d6f Fixed #29067 -- Fixed regression in QuerySet.values_list(..., flat=True) followed by annotate(). 2018-01-26 09:35:50 -05:00
Mads Jensen
a51c4de194 Used assertRaisesMessage() to test Django's error messages. 2017-07-29 19:07:23 -04:00
Simon Charette
daf2bd3efe Fixed #28107 -- Disabled grouping of selected primary keys for unmanaged models.
The grouping caused an issue with database views as PostgreSQL's query planer
isn't smart enough to introspect primary keys through views. Django doesn't
support database views but documents that unmanaged models should be used to
query them.

Thanks powderflask for the detailed report and investigation.
2017-05-11 20:00:57 -04:00
Claude Paroz
2b281cc35e Refs #23919 -- Removed most of remaining six usage
Thanks Tim Graham for the review.
2017-01-18 21:33:28 +01:00
Claude Paroz
d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
Josh Smeaton
1df89a60c5 Fixed #25307 -- Fixed QuerySet.annotate() crash with conditional expressions.
Thanks Travis Newport for the tests and Josh Smeaton for contributing
to the patch.
2017-01-16 10:03:15 -05:00
Mariusz Felisiak
6dbe56ed78 Fixed #27632 -- Unified query parameters by their values on Oracle. 2016-12-28 08:14:14 -05:00
za
321e94fa41 Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. 2016-11-10 21:30:21 -05:00
Tim Graham
b3330f52a8 Fixed typo in tests/aggregation_regress/tests.py. 2016-09-24 18:17:53 -04:00
Mads Jensen
0c1f71635f Fixed #27203 -- Replaced assertQuerysetEqual(..., lambda o: o) with assertSequenceEqual(). 2016-09-13 10:07:37 -04:00
Tim Graham
92053acbb9 Fixed E128 flake8 warnings in tests/. 2016-04-08 10:12:33 -04:00
Tim Graham
2cd2d18851 Fixed W503 flake8 warnings. 2016-04-04 17:14:26 -04:00
Tim Graham
1c8c0837c6 Sorted single letter imports per the latest version of isort. 2016-03-28 11:45:31 -04:00
Tim Graham
406675b1a0 Fixed #26176 -- Fixed E123 flake8 warnings. 2016-02-05 15:11:07 -05:00
Hasan
3d0dcd7f5a Refs #26022 -- Used context manager version of assertRaises in tests. 2016-01-29 12:32:18 -05:00
Josh Soref
93452a70e8 Fixed many spelling mistakes in code, comments, and docs. 2015-12-03 12:48:24 -05:00
Dražen Odobašić
b1e33ceced Fixed #23395 -- Limited line lengths to 119 characters. 2015-09-12 11:40:50 -04:00
Renato Oliveira
e3720b990a Fixed #25382 -- Removed obsolete references to DateQuerySet. 2015-09-11 12:16:06 -04:00
Tim Graham
3e1bb5cfb8 Refs #14476 -- Added a test for default annotation name access in aggregate.
Fixed in f59fd15c49
2015-08-06 13:52:26 -04:00
Michael Tänzer
3bbaf84d65 Fixed #18247 -- Added cast to NUMERIC for Decimals on sqlite
On sqlite the SUM() of a decimal column doesn't have a NUMERIC type so
when comparing it to a string literal (which a Decimal gets converted to
in Django) it is not compared as expected.
2015-06-30 18:27:42 -04:00
Anssi Kääriäinen
adc57632bc Fixed #24748 -- Fixed incorrect GROUP BY on MySQL in some queries
When the query's model had a self-referential foreign key, the
compiler.get_group_by() code incorrectly used the self-referential
foreign key's column (for example parent_id) as GROUP BY clause
when it should have used the model's primary key column (id).
2015-05-11 11:42:27 -04:00
Simon Charette
dc27f3ee0c Fixed #19259 -- Added group by selected primary keys support. 2015-03-29 22:03:30 -04:00
Anssi Kääriäinen
fb146193c4 Fixed #24171 -- Fixed failure with complex aggregate query and expressions
The query used a construct of qs.annotate().values().aggregate() where
the first annotate used an F-object reference and the values() and
aggregate() calls referenced that F-object.

Also made sure the inner query's select clause is as simple as possible,
and made sure .values().distinct().aggreate() works correctly.
2015-03-09 07:49:23 -04:00
Josh Smeaton
39a7eed1bb Converted test fixtures to setUpTestData methods 2015-03-05 10:10:32 +11:00
Tim Graham
0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Loic Bistuer
4c3bfe9053 Fixed #24211 -- Removed ValuesQuerySet() and ValuesListQuerySet().
Thanks Anssi Kääriäinen, Marc Tamlyn, and Tim Graham for the reviews.
2015-01-30 22:02:58 +07:00
Anssi Kääriäinen
0c7633178f Fixed #24020 -- Refactored SQL compiler to use expressions
Refactored compiler SELECT, GROUP BY and ORDER BY generation.
While there, also refactored select_related() implementation
(get_cached_row() and get_klass_info() are now gone!).

Made get_db_converters() method work on expressions instead of
internal_type. This allows the backend converters to target
specific expressions if need be.

Added query.context, this can be used to set per-query state.

Also changed the signature of database converters. They now accept
context as an argument.
2015-01-08 14:07:54 -05:00
Anssi Kääriäinen
bd337184f1 Fixed #23877 -- aggregation's subquery missed target col
Aggregation over subquery produced syntactically incorrect queries in
some cases as Django didn't ensure that source expressions of the
aggregation were present in the subquery.
2014-11-27 06:50:08 -05:00
Berker Peksag
f7969b0920 Fixed #23620 -- Used more specific assertions in the Django test suite. 2014-11-03 11:56:37 -05:00
Claude Paroz
374c14b7fd Fixed #23659 -- Kept annotate() args ordering
Thanks Loic Bistuer and Simon Charette for the review.
2014-10-16 09:27:20 +02:00
Marc Tamlyn
e9103402c0 Fixed #18757, #14462, #21565 -- Reworked database-python type conversions
Complete rework of translating data values from database

Deprecation of SubfieldBase, removal of resolve_columns and
convert_values in favour of a more general converter based approach and
public API Field.from_db_value(). Now works seamlessly with aggregation,
.values() and raw queries.

Thanks to akaariai in particular for extensive advice and inspiration,
also to shaib, manfre and timograham for their reviews.
2014-09-03 20:36:03 +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
Alex Gaynor
c347f78cc1 Fixed all E226 violations 2013-11-03 10:08:55 -08:00
coagulant
3bc0d46a84 Fixed all E261 warnings 2013-11-02 18:20:39 -04:00
Alex Gaynor
b35ff0d920 Fixed all the E203 violations 2013-10-26 18:27:42 -07:00
Alex Gaynor
9d740eb8b1 Fix all violators of E231 2013-10-26 12:15:03 -07:00
Tim Graham
499cd912ca Fixed E227 pep8 warnings 2013-10-21 08:52:21 -04:00
Alasdair Nicol
a800036981 Fixed #21287 -- Fixed E123 pep8 warnings 2013-10-18 10:07:39 +01:00
Tim Graham
b67ab75e82 Fixed assorted flake8 errors. 2013-10-11 07:25:14 -04: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
ed0d720b78 Fixed #21150 -- select_related + annotate join promotion failure
Added tests for a .annotate().select_related() join promotion failure.
This happened to work on master but was currently untested.
2013-10-05 14:52:17 +03:00
Anssi Kääriäinen
83554b018e Fixed #21126 -- QuerySet value conversion failure
A .annotate().select_related() query resulted in misaligned rows vs
columns for compiler.resolve_columns() method.

Report & patch by Michael Manfre.
2013-09-25 20:47:57 +03:00
Michael Manfre
9a041807fc Fixed #18333 - Quoted annotated column names 2013-09-24 10:10:08 -04:00
Kevin Christopher Henry
9d700322b3 Fixed #19885 -- cleaned up the django.test namespace
* override_settings may now be imported from django.test
* removed Approximate from django.test
* updated documentation for things importable from django.test

Thanks akaariai for the suggestion.
2013-09-09 16:03:13 -04:00
Florian Hahn
e888a9b30d Fixed #15624 -- Made sure aggregations are present in SELECT 2013-07-31 16:27:58 +03:00
Claude Paroz
5c1143910e Removed most of absolute_import imports
Should be unneeded with Python 2.7 and up.
Added some unicode_literals along the way.
2013-07-29 20:28:13 +02:00
Aymeric Augustin
cfcf4b3605 Stopped using django.utils.unittest in the test suite.
Refs #20680.
2013-07-01 14:29:33 +02:00
Anssi Kääriäinen
33dd8f5442 Fixed random aggregation_regress test_more_more_more() failure
The cause was assuming that an unordered queryset returns the values
always in the same order.
2013-05-28 08:55:04 +03:00
Anssi Kääriäinen
bd0cba58aa Fixed failing aggregation tests on MySQL 2013-03-13 12:44:24 +02:00