Commit Graph

80 Commits

Author SHA1 Message Date
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
Daniel Hones 9d129b72ce Fixed #29047 -- Corrected Substr test to use expressions.
Regression in e2d6e14662.
2018-01-24 08:07:28 -05:00
Mads Jensen 65728550bd Refs #28643 -- Added Replace database function. 2018-01-17 20:46:15 -05:00
hayashi 27557a7a99 Fixed #28857 -- Fixed invalid SQL when using Cast with complex expressions on PostgreSQL. 2018-01-17 09:28:03 -05:00
Sergey Fedoseev 44908d4d93 Fixed #28967 -- Prevented Cast to FloatField from rounding to integer on MySQL. 2017-12-27 19:16:37 -05:00
Mariusz Felisiak fc9eec7bb7 Fixed #28934 -- Prevented Cast from truncating microseconds on Oracle. 2017-12-20 11:05:27 -05:00
Mariusz Felisiak 4420761ea9
Fixed #28727 -- Fixed Cast crash on SQLite when casting a Python date/datetime to Date/DateTimeField. 2017-12-19 19:54:58 +01:00
Tim Graham a80903b711 Removed DatabaseFeatures.supports_microsecond_precision.
MySQL 5.5 (refs #28552) was the last database to use it.
2017-09-25 14:48:15 -04:00
Mads Jensen d549b88050 Fixed #26608 -- Added support for window expressions (OVER clause).
Thanks Josh Smeaton, Mariusz Felisiak, Sergey Fedoseev, Simon Charettes,
Adam Chainz/Johnson and Tim Graham for comments and reviews and Jamie
Cockburn for initial patch.
2017-09-18 09:42:29 -04:00
Mariusz Felisiak b61d5b1991 Fixed #28371 -- Fixed Cast() with CharField if the max_length argument isn't provided.
Thanks Tim Graham for the review.
2017-07-27 19:36:47 +02:00
Mariusz Felisiak 776cee9749 Fixed #28391 -- Fixed Cast() with CharField and max_length on MySQL.
Thanks Tim Graham for the review.
2017-07-17 21:12:27 +02:00