Commit Graph

90 Commits

Author SHA1 Message Date
Hasan Ramezani 275dd4ebba
Fixed #32178 -- Allowed database backends to skip tests and mark expected failures.
Co-authored-by: Tim Graham <timograham@gmail.com>
2020-12-10 18:00:57 +01:00
Artur Beltsov 48b4bae983 Fixed #32179 -- Added JSONObject database function. 2020-12-02 09:30:50 +01:00
David-Wobrock ee005328c8 Fixed #31640 -- Made Trunc() truncate datetimes to Date/TimeField in a specific timezone. 2020-10-14 20:06:26 +02:00
David-Wobrock 8d018231ac Removed redundant tests in test_extract_trunc.
tzinfo is ignored for DateFields and TimeFields, and it's already
covered by DateFunctionTests.test_trunc_func().
2020-10-14 20:03:44 +02:00
David-Wobrock a0571c1003 Refs #31640 -- Made Extract raise ValueError when using tzinfo with Date/TimeField. 2020-10-14 20:03:07 +02:00
Nick Pope 06c5d3fafc Fixed #32060 -- Added Random database function. 2020-10-02 06:58:03 +02:00
Tom Carrick 278b6187d2 Refs #21181 -- Corrected DatabaseFeatures.test_collations for Swedish collation.
Previously, backends used different keys "swedish-ci" or "swedish_ci".
2020-09-18 12:15:46 +02:00
Petr Čermák fc1446073e Fixed #31987 -- Fixed Cast() with DurationField on MySQL. 2020-09-09 07:01:18 +02:00
Joe Jackson 9d5d865fd6 Fixed #31948 -- Added tzinfo parameter to TruncDate() and TruncTime(). 2020-09-02 07:42:27 +02:00
Tom Carrick 63300f7e68 Fixed #21181 -- Added Collate database function.
Thanks Simon Charette for reviews.
2020-08-11 22:21:08 +02:00
Simon Charette ea3beb4f5a Refs #30446 -- Defined default output_field of text database functions.
This prevented the default behavior of
BaseExpression._resolve_output_field from error'ing out when such
functions accepted both expressions from mixed types
(e.g. SubStr(CharField, IntegerField, IntegerField)).
2020-06-16 10:08:02 +02:00
Mariusz Felisiak 555e3a848e
Removed unused __str__() methods in tests models.
Follow up to 6461583b6c.
2020-04-30 09:13:23 +02:00
Nick Pope 335c9c94ac Simplified imports from django.db and django.contrib.gis.db. 2020-02-04 13:20:06 +01:00
Caio Ariede 555bebe774 Fixed #30987 -- Added models.PositiveBigIntegerField. 2019-11-19 09:34:11 +01:00
Jon Dufresne aa12cf07c9 Removed unnecessary numeric indexes in format strings. 2019-11-19 08:29:47 +01:00
Nick Pope 7552de7866 Used more specific unittest assertions in tests.
* assertIsNone()/assertIsNotNone() instead of comparing to None.
* assertLess() for < comparisons.
* assertIs() for 'is' expressions.
* assertIsInstance() for isinstance() expressions.
* rounding of assertAlmostEqual() for round() expressions.
* assertIs(..., True/False) instead of comparing to True/False.
* assertIs()/assertIsNot() for ==/!= comparisons.
* assertNotEqual() for == comparisons.
* assertTrue()/assertFalse() instead of comparing to True/False.
2019-10-29 12:37:30 +01:00
Anatol Ulrich 8ed6788aa4 Fixed #30821 -- Added ExtractIsoWeekYear database function and iso_week_day lookup. 2019-10-02 10:41:34 +02:00
Nick Pope 194d1dfc18 Fixed #30661 -- Added models.SmallAutoField. 2019-08-02 11:39:01 +02:00
Hasan Ramezani 402e6d292f Fixed #30602 -- Made Extract raise ValueError when using unsupported lookups for DurationField. 2019-07-12 08:08:35 +02:00
can fde9b7d35e Fixed #30128 -- Fixed handling timedelta timezone in database functions. 2019-06-13 09:29:43 +02:00
Simon Charette 2b582a7b84 Fixed #29396 -- Added indirect values support to __year lookups.
Thanks Windson Yang for the initial patch.
2019-05-21 07:12:33 +02:00
Simon Charette 4d1420947e Fixed #30494 -- Disabled __year lookup optimization for indirect values.
The previous heuristics were naively enabling the BETWEEN optimization on
successful cast of the first rhs SQL params to an integer while it was
not appropriate for a lot of database resolved expressions.

Thanks Alexey Chernov for the report.
2019-05-21 07:11:26 +02:00
Nick Pope d26b242443
Fixed #30271 -- Added the Sign database function. 2019-03-22 12:52:39 +01:00
Nick Pope 0b70985f42 Fixed #30240 -- Added SHA1, SHA224, SHA256, SHA384, and SHA512 database functions.
Thanks Mariusz Felisiak and Tim Graham for reviews.
2019-03-20 19:30:43 +01:00
Mariusz Felisiak 258110d6cd Simplified test_transform()s in db_functions.math. 2019-03-14 19:42:01 -04:00
ahbk d527639804 Fixed #29754 -- Added is_dst parameter to Trunc database functions. 2019-03-07 10:02:18 -05:00
Mariusz Felisiak 9ff18c08c3
Refs #28643 -- Added MD5 database function.
Thanks Tim Graham, Nick Pope and Simon Charette for reviews.
2019-02-21 10:52:51 +01:00
Nick Pope abf8e390a4 Refs #28643 -- Added Reverse database function.
Thanks Mariusz Felisiak for Oracle advice and review.
2019-01-12 10:45:48 -05:00
Mads Jensen 4b9d72210f Refs #28643 -- Added NullIf database function.
Thanks Nick Pope, Mariusz Felisiak, and Tim Graham for reviews.
2019-01-10 12:10:12 -05:00
Mariusz Felisiak f2e2a1bd4b
Fixed #29845 -- Fixed Cast crash on MySQL when casting to DecimalField. 2018-10-15 15:57:22 +02:00
Claude Paroz fc3a463048 Fixed #29767 -- Made date-related casts work on SQLite
Thanks Rémy Hubscher for the report and Tim Graham and Simon Charette for the reviews.
2018-10-01 13:27:30 +02:00
Srinivas Reddy Thatiparthy 34d6bceec4 Fixed #29500 -- Fixed SQLite function crashes on null values.
Co-authored-by: Srinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>
Co-authored-by: Nick Pope <nick.pope@flightdataservices.com>
2018-09-10 15:08:55 -04:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) 233c70f047 Fixed #29658 -- Registered model lookups in tests with a context manager. 2018-08-21 12:17:46 -04:00
Sigurd Ljødal 3e09b37f80 Fixed #28649 -- Added ExtractIsoYear database function and iso_year lookup. 2018-08-18 13:09:15 -04:00
Nick Pope b523d42561 Reorganized datetime db function tests. 2018-08-16 16:18:09 -04:00
Nick Pope 5c3db0ef6a Reorganized comparison db function tests. 2018-08-16 16:04:39 -04:00
Nick Pope 3288985822 Reorganized text db function tests. 2018-08-16 15:44:31 -04:00
Nick Pope dd3feb0891 Reorganized window db function tests. 2018-08-16 09:32:42 -04:00
Raphael Michel 155b31d4ec Fixed #29648 -- Fixed crash when using subqueries inside datetime truncation functions. 2018-08-07 16:47:54 -04:00
Mariusz Felisiak ac25dd1f8d
Fixed #29569 -- Fixed Cast() with AutoField and BigAutoField. 2018-07-25 08:00:11 +02:00
Junyi Jiao a0b19a0f5b Refs #28643 -- Added math database functions.
Thanks Nick Pope for much review.
2018-07-05 11:02:12 -04:00
Mariusz Felisiak 55cc26941a
Refs #28643 -- Added Repeat database function.
Thanks Tim Graham and Nick Pope for reviews.
2018-04-03 19:36:12 +02:00
Mariusz Felisiak 6141c752fe
Fixed #29251 -- Added bytes to str conversion in LPad/RPad database functions on MySQL.
Thanks Tim Graham for the review.
2018-04-03 18:24:04 +02:00
Mariusz Felisiak cede5111bb
Refs #28643 -- Added LPad and RPad database functions.
Thanks Tim Graham for the review.
2018-03-19 17:35:16 +01:00
Mariusz Felisiak 9421aee35e
Refs #28643 -- Added LTrim, RTrim, and Trim database functions.
Thanks Tim Graham and Mads Jensen for reviews.
2018-03-15 20:57:23 +01:00
Sergey Fedoseev d696fccae6 Fixed #29209 -- Fixed Cast() with TextField on MySQL and Oracle. 2018-03-12 21:57:14 -04:00
bobort f82de6bfb1 Refs #28643 -- Added Ord, Chr, Left, and Right database functions. 2018-02-23 10:23:22 -05:00
Tim Graham 548f78ba46
Removed redundant lookup name in register_lookup() calls. 2018-02-19 13:12:13 -05:00
Mariusz Felisiak 9bcf73d788 Fixed imports per isort 4.3.0. 2018-02-01 09:29:46 +01:00
Sigurd Ljødal a455e732a0 Fixed #28650 -- Added TruncWeek database function. 2018-01-27 09:59:13 -05:00