Commit Graph

3785 Commits

Author SHA1 Message Date
Chris Sinchok 66150f7cf6 Fixed #27954 -- Allowed keyboard interrupt to abort queries in PostgreSQL dbshell.
Thanks Tim Martin for review.
2017-04-01 21:01:08 -04:00
Sergey Fedoseev bde86ce9ae Fixed #25605 -- Made GIS DB functions accept geometric expressions, not only values, in all positions. 2017-04-01 09:47:49 -04:00
Sergey Fedoseev 068d75688f Refs #18247 -- Fixed SQLite QuerySet filtering on decimal result of Least and Greatest. 2017-03-29 13:29:53 -04:00
Mariusz Felisiak 1d070d027c Fixed #25414 -- Fixed QuerySet.annotate() with pk in values() on MySQL.
Thanks Tim Graham and Simon Charette for the reviews.
2017-03-29 06:47:07 +02:00
Tim Graham b59c0d722d Refs #18974 -- Added stacklevel for permalink() deprecation. 2017-03-28 17:58:10 -04:00
Tim Graham eca6f91be2 Updated cx_Oracle arraysize comment. 2017-03-28 09:41:45 -04:00
Mads Jensen ed0cbc8d8b Refs #23919 -- Removed some Python 2 compatibility code and comments. 2017-03-27 13:12:27 -04:00
Mariusz Felisiak 1b6f05e91f Fixed #21160 -- Fixed QuerySet.in_bulk() crash on SQLite when requesting more than 999 ids.
Thanks Andrei Picus and Anssi Kääriäinen for the initial patch
and Tim Graham for the review.
2017-03-27 18:43:40 +02:00
Mariusz Felisiak f42c7cc87b Refs #21160 -- Replaced DatabaseFeatures.supports_1000_query_parameters by a DatabaseFeatures.max_query_params. 2017-03-24 18:37:03 +01:00
Kapil Garg 7e09fa7f51 Fixed #27969 -- Fixed models.Field.formfield() setting 'disabled' for fields with choices. 2017-03-23 13:22:04 -04:00
Sergey Fedoseev 40ffabe8dc Removed unneeded Value wraps in Substr.
Unneeded since e2d6e14662.
2017-03-23 10:50:56 -04:00
Mariusz Felisiak 43380e9110 Fixed #27966 -- Bumped required psycopg2 version to 2.5.4.
Thanks Tim Graham for the review.
2017-03-21 17:23:17 +01:00
Tim Graham 3d19d1428a Fixed #27915 -- Allowed Meta.indexes to be defined in abstract models.
Thanks Markus Holtermann for review.
2017-03-21 10:53:21 -04:00
Mads Jensen 19b8ca5824 Removed unused connector parameter of Query.build_filter().
Unused since 6fe2b001db.
2017-03-18 09:04:56 -04:00
Mads Jensen e45633086c Removed unused rest_of_lookups parameter of Query.try_transform().
Unused since 534aaf56f4.
2017-03-18 09:00:59 -04:00
Mads Jensen 82bb4e684f Fixed #27935 -- Fixed crash with BrinIndex name > 30 characters. 2017-03-18 08:12:10 -04:00
Brad Melin b625907a79 Fixed #27834 -- Added StrIndex database function. 2017-03-14 19:58:56 -04:00
Mads Jensen e7033e00f8
Used constant instead of hard-coded value for max index name length
Refs #26709
2017-03-14 15:50:37 +01:00
Adam Chainz a452dddb25 Fixed #27904 -- Added a system check that Field.validators are callable. 2017-03-11 12:27:29 -05:00
Mariusz Felisiak 75503a823f Fixed #27924 -- Added support for cx_Oracle 5.3.
- Fixed Oracle backend due to cx_Oracle 5.3 change in the
Cursor.description behavior i.e. "Use None instead of 0 for items in
the Cursor.description attribute that do not have any validity.".
- Used cx_Oracle.Object.size() instead of len().
Thanks Tim Graham for the review.
2017-03-10 23:02:44 +01:00
Mariusz Felisiak 94d8bea212 Fixed #24365 -- Made inspectdb translate MySQL unsigned integer columns to positive integer fields. 2017-03-08 10:56:00 -05:00
Adam Johnson af121b08e8 Refs #27624 -- Made many attributes of Query immutable. 2017-03-08 09:25:44 -05:00
Bo Marchman 9bbb6e2d25 Fixed #26522 -- Fixed a nondeterministic AssertionError in QuerySet combining.
Thanks Andrew Brown for the test case.
2017-03-06 13:40:17 -05:00
Claude Paroz 8346680e1c Refs #27795 -- Removed unneeded force_text calls
Thanks Tim Graham for the review.
2017-03-04 18:18:21 +01:00
Mariusz Felisiak 6b47431aaf Refs #27860 -- Simplified deleting indexes on PostgreSQL using "IF EXISTS". 2017-03-03 10:50:34 -05:00
Tim Graham 29ea9714ee Removed PostgreSQL version detection for psycopg2 < 2.0.12. 2017-03-01 13:17:34 -05:00
Matthew Schinckel f48bc7c3db Fixed #27862 -- Fixed incorrectly quoted table aliases in Subquery SQL.
Add aliases from resolved querysets to the parent query's external
aliases to prevent those aliases from being quoted.

Thanks to Vasily Stepanov for the report and Tim Graham for the review.
2017-03-01 07:56:37 -05:00
Anton Samarchyan 60e52a047e Refs #27656 -- Updated django.db docstring verbs according to PEP 257. 2017-02-28 09:17:27 -05:00
Tim Graham d6e26e5b7c Removed obsolete references to form_for_instance(). 2017-02-28 07:37:25 -05:00
Tim Graham 6b00af5014 Refs #27802 -- Corrected BaseDatabaseOperations.datetime_extract/trunc_sql() docstrings. 2017-02-27 10:07:24 -05:00
Tim Graham 82026d61a3 Refs #27843 -- Fixed 'invalid escape sequence' warning in truncate_name(). 2017-02-27 09:28:02 -05:00
Ian Foote 508b5debfb Refs #11964 -- Made Q objects deconstructible. 2017-02-23 20:47:48 -05:00
Ian Foote 19b2dfd1bf Refs #11964, #26167 -- Made Expressions deconstructible. 2017-02-23 20:44:06 -05:00
Vytis Banaitis 3dcc351691 Refs #23919 -- Used yield from. 2017-02-23 20:06:01 -05:00
Tim Graham 0a0c24581e Refs #26285 -- Removed postgresql's unused DatabaseOperations.fulltext_search_sql().
Should have been removed in 5139832398.
2017-02-21 13:10:24 -05:00
Vytis Banaitis 4045fd56cb Fixed #27856 -- Improved accuracy of date subtraction on PostgreSQL.
Accuracy was incorrect when dates differ by a month or more.
2017-02-21 12:06:16 -05:00
Alexey Rogachev c743af82cf Fixed typo in DurationField's docstring. 2017-02-20 08:44:05 -05:00
Mariusz Felisiak b935190572 Fixed #27843 -- Fixed truncate_name() when the name contains a username. 2017-02-17 09:24:55 -05:00
Vytis Banaitis d5088f838d Fixed #27828 -- Fixed a crash when subtracting Integer/DurationField from DateField on Oracle/PostgreSQL. 2017-02-16 11:46:32 -05:00
Tim Graham b008f7cc56 Fixed #27135 -- Made index introspection return Index.suffix. 2017-02-15 20:15:02 -05:00
Tim Graham 0595bca221 Fixed #27742 -- Reverted "Fixed #24607 -- Serialized natural keys in multi-table inheritance models."
This reverts commit 74a575eb72 as it causes
unexpected migrations and doesn't seem to be the best solution.
2017-02-11 06:34:59 -05:00
ClairePhila d26413113c Refs #27148 -- Fixed UUIDField.to_python(None) crash.
Regression in 2f9861d823.
2017-02-10 13:54:52 -05:00
ClairePhila edad02af06 Allow UUIDField to be None when deserializing 2017-02-10 17:26:02 +01:00
Mikhail Nacharov c4e2fc5d98 Fixed #22669 -- Fixed QuerySet.bulk_create() with empty model fields on Oracle. 2017-02-09 18:47:08 -05:00
Mariusz Felisiak 965f678a39 Fixed #25898 -- Made test database/user creation on Oracle reraise unexpected errors.
Thanks Shai Berger and Tim Graham for review.
2017-02-09 17:55:07 -05:00
François Freitag e124d2da94 Fixed #26551 -- Fixed negated Q() queries that span relations.
Prevented queries from reusing trimmed joins.
2017-02-09 11:20:33 -05:00
Tim Graham 500532c95d Refs #23919 -- Removed default 'utf-8' argument for str.encode()/decode(). 2017-02-09 09:03:47 -05:00
Mariusz Felisiak 1b96dbdad0 Fixed #27822 -- Replaced deprecated cx_Oracle types in DatabaseIntrospection.data_types_reverse. 2017-02-09 08:57:34 -05:00
Claude Paroz c651331b34 Converted usage of ugettext* functions to their gettext* aliases
Thanks Tim Graham for the review.
2017-02-07 09:04:04 +01:00
Mariusz Felisiak 15c14f6f16 Fixed #27802 -- Unified return value of db backend datetime SQL methods. 2017-02-06 09:19:13 -05:00
Mads Jensen 86ae1d51ed Refs #27546 -- Removed hardcoded class names in __repr__() methods. 2017-02-04 11:42:45 -05:00
Tim Graham 29f607927f Fixed spelling of "nonexistent". 2017-02-03 08:01:45 -05:00
Tim Graham 924af638e4 Fixed #27683 -- Made MySQL default to the read committed isolation level.
Thanks Shai Berger for test help and Adam Johnson for review.
2017-02-01 15:34:17 -05:00
Vytis Banaitis 8838d4dd49 Refs #23919 -- Replaced kwargs.pop() with keyword-only arguments. 2017-02-01 11:41:56 -05:00
Lex Berezhny ac5f886c56 Fixed #27800 -- Fixed QuerySet.annotate(Length(...)).distinct() crash. 2017-01-31 18:45:55 -05:00
Claude Paroz 52138b1fd0 Refs #23919 -- Removed usage of obsolete SafeBytes class
The class will be removed as part of #27753.
Thanks Tim Graham for the review.
2017-01-30 15:04:45 +01:00
Mariusz Felisiak 89501d9298 Fixed #27789 -- Simplified query for sequence value on Oracle. 2017-01-30 08:03:42 -05:00
Tim Graham 0de0699d94 Fixed #27788 -- Dropped support for Oracle < 12.1. 2017-01-28 08:19:47 -05:00
Vytis Banaitis d1bab24e01 Refs #23919, #27778 -- Removed obsolete mentions of unicode. 2017-01-26 08:19:27 -05:00
Tim Graham 1c466994d9 Refs #23919 -- Removed misc Python 2/3 references. 2017-01-25 13:59:25 -05:00
chillaranand d6eaf7c018 Refs #23919 -- Replaced super(ClassName, self) with super(). 2017-01-25 12:23:46 -05:00
Tim Graham 2d96c027f5 Refs #23919 -- Removed obsolete MySQLdb references. 2017-01-25 10:16:10 -05:00
Tim Graham 3f0c4fe18f Refs #25175 -- Deprecated db.backends.postgresql_psycopg2 module. 2017-01-25 09:23:04 -05:00
Mads Jensen ebf34c3cdc Removed unused variables that are overwritten. 2017-01-25 09:14:05 -05:00
Tim Graham 5b95d421f7 Refs #23919 -- Removed a MySQLdb workaround (refs #6052) for Python 2. 2017-01-24 08:35:06 -05:00
Tim Graham a87d6b69a7 Tidied djang.db.utils.load_backend().
Removed an unneeded EnvironmentError catching and used
"raise from exc" syntax.
2017-01-24 08:33:26 -05:00
Tim Graham 435e4bf38e Refs #23919 -- Removed __traceback__ setting needed for Python 2.
Partially reverted refs #25761 and refs #16245.
2017-01-24 08:31:58 -05:00
Tim Graham 248d54569e Removed MySQL decimal casting.
Added in Django 1.0: 92c35a0617
Unknown when it became obsolete.
2017-01-23 10:44:02 -05:00
Claude Paroz 8377a98ca5 Removed obsolete force_text_recursive 2017-01-22 21:13:00 +01:00
Claude Paroz 6e55e1d88a Refs #23919 -- Replaced six.reraise by raise 2017-01-22 20:08:04 +01:00
Tim Graham d170c63351 Refs #23919 -- Removed misc references to Python 2. 2017-01-21 20:02:00 -05:00
Mariusz Felisiak c22212220a Refs #23919 -- Removed re.U and re.UNICODE (default on Python 3). 2017-01-21 14:28:16 -05:00
Tim Graham 1b06d5e6f6 Refs #23919 -- Removed pysqlite support (it's Python 2 only). 2017-01-20 18:21:15 -05:00
Claude Paroz 042b7350a0 Refs #23919 -- Removed unneeded str() calls 2017-01-20 14:13:55 +01:00
Tim Graham 4e729feaa6 Refs #23919 -- Removed django.utils._os.upath()/npath()/abspathu() usage.
These functions do nothing on Python 3.
2017-01-20 08:01:02 -05:00
Claude Paroz dc8834cad4 Refs #23919 -- Removed unneeded force_str calls 2017-01-20 08:44:31 +01:00
Mariusz Felisiak bf1c957027 Refs #23919 -- Removed Python 2 workaround for hashing Oracle params (refs #27632). 2017-01-19 22:20:14 -05:00
Tim Graham 9ee47ce7b4 Refs #23919 -- Removed enum ImportError handling for Python 2. 2017-01-19 13:55:20 -05:00
Simon Charette 9695b14982 Refs #23919 -- Removed str() conversion of type and method __name__. 2017-01-19 11:31:07 -05:00
Chillar Anand 41e0033caf Refs #23919 -- Removed usage of django.utils.decorators.ContextDecorator. 2017-01-19 11:28:30 -05:00
Simon Charette 4c5ed3e683 Refs #23919 -- Removed __nonzero__() methods (for Python 2).
Thanks Tim for the review.
2017-01-19 11:26:26 -05:00
james mike dupont 7d20094996 Fixed spelling mistakes in code and comments. 2017-01-19 07:52:41 -05:00
Simon Charette cecc079168 Refs #23919 -- Stopped inheriting from object to define new style classes. 2017-01-19 08:39:46 +01:00
Aymeric Augustin eb422e476f Refs #23919 -- Removed obsolete __ne__() methods.
__ne__() defaults to the opposite of __eq__() on Python 3
when it doesn't return NotImplemented.
2017-01-18 21:44:00 -05:00
Aymeric Augustin 3cc5f01d9b Refs #23919 -- Stopped using django.utils.lru_cache(). 2017-01-18 21:42:40 -05: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 7b2f2e74ad Refs #23919 -- Removed six.<various>_types usage
Thanks Tim Graham and Simon Charette for the reviews.
2017-01-18 20:18:46 +01:00
Claude Paroz c716fe8782 Refs #23919 -- Removed six.PY2/PY3 usage
Thanks Tim Graham for the review.
2017-01-18 16:21:28 +01:00
Claude Paroz f3c43ad1fd Refs #23919 -- Removed python_2_unicode_compatible decorator usage 2017-01-18 13:44:34 +01:00
Claude Paroz d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
Tim Graham 631f4ab061 Removed Manager.use_for_related_fields and Meta.manager_inheritance_from_future.
Per deprecation timeline. Refs ed0ff913c6.
2017-01-17 20:52:04 -05:00
Tim Graham 0dfc5479a8 Refs #26058 -- Removed deprecated FileField.get_directory_name()/get_filename(). 2017-01-17 20:52:04 -05:00
Tim Graham 9d0e8c1e7f Refs #26320 -- Removed implicit OneToOnField parent_link per deprecation timeline. 2017-01-17 20:52:04 -05:00
Tim Graham 933dc62742 Refs #16508 -- Removed virtual aliases of "private fields".
Per deprecation timeline.
2017-01-17 20:52:03 -05:00
Tim Graham b70094f040 Refs #26226 -- Removed support for related manager classes without a _apply_rel_filters() method.
Per deprecation timeline.
2017-01-17 20:52:03 -05:00
Tim Graham 5139832398 Refs #26285 -- Removed MySQL __search lookup per deprecation timeline. 2017-01-17 20:52:03 -05:00
Tim Graham bfe0d54514 Refs #26230 -- Removed support for model name query lookups when using Meta.default_related_name.
Per deprecation timeline.
2017-01-17 20:52:03 -05:00
Tim Graham bcf3532ede Refs #26154 -- Removed deprecated CommaSeparatedIntegerField. 2017-01-17 20:52:02 -05:00
Tim Graham ed251246cc Refs #25550 -- Removed support for direct assignment to the reverse side of a related set. 2017-01-17 20:52:01 -05:00
Tim Graham 733c7c7030 Refs #24716 -- Removed Field._get_val_from_obj() per deprecation timeline. 2017-01-17 20:52:00 -05:00
Tim Graham e707e4c709 Refs #19738 -- Removed timezone conversion in SQL queries executed outside of the ORM.
Per deprecation timeline.
2017-01-17 14:09:29 -05:00
Tim Graham b2ffbb00a5 Refs #24215 -- Removed add_lazy_relation() per deprecation timeline. 2017-01-17 14:09:29 -05:00
Tim Graham ddd3268975 Refs #21127 -- Required on_delete for ForeignKey/OneToOneField.
Per deprecation timeline.
2017-01-17 14:09:28 -05:00
Tim Graham 625e9da9ca Removed Field.rel and Field.remote_field.to per deprecation timeline. 2017-01-17 14:09:28 -05:00
Tim Graham a3bd8672d8 Refs #24154 -- Removed deprecated BaseDatabaseOperations.check_aggregate_support(). 2017-01-17 14:09:28 -05:00
Tim Graham 03087f80d1 Refs #24205 -- Removed Signal.disconnect()'s weak argument.
Per deprecation timeline.
2017-01-17 14:09:28 -05:00
Tim Graham f01ad1cb6a Refs #27683 -- Allowed setting isolation level in DATABASES ['OPTIONS'] on MySQL. 2017-01-17 11:16:15 -05:00
Markus Holtermann 46e0335583 Refs #27666 -- Added ProjectState.reload_models(). 2017-01-17 08:12:53 -05:00
Markus Holtermann 45ded053b1 Fixed #27666 -- Delayed rendering of recursivly related models in migration operations. 2017-01-17 08:12:52 -05:00
Mariusz Felisiak 7d2db2a7b8 Refs #27690 -- Removed sleep before drop test db on Oracle. 2017-01-16 19:20:28 -05:00
Mads Jensen 65e321b781 Refs #25809 -- Made a few late review comments for BrinIndex. 2017-01-16 13:23:20 -05:00
Tim Graham b5511dddd6 Moved unneeded ImproperlyConfigured inner imports. 2017-01-16 12:48:41 -05: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
Mads Jensen 0bc59978ab Fixed #27736 -- Used decorators for lookup registration. 2017-01-16 09:22:26 -05:00
François Freitag 05bdf4f44d Refs #16614 -- Called _prepare_cursor() on every created cursor. 2017-01-16 09:12:23 -05:00
Mads Jensen e585c43be9 Fixed #25809 -- Added BrinIndex support in django.contrib.postgres.
Thanks Tim Graham and Markus Holtermann for review.
2017-01-15 13:37:18 +01:00
Matthew Schinckel 236ebe94bf Fixed #27149 -- Added Subquery and Exists database expressions.
Thanks Josh Smeaton for Oracle fixes.
2017-01-14 09:12:24 -05:00
Florian Apolloner 84c1826ded Fixed #27718 -- Added QuerySet.union(), intersection(), difference().
Thanks Mariusz Felisiak for review and Oracle assistance.
Thanks Tim Graham for review and writing docs.
2017-01-14 08:32:07 -05:00
François Freitag 6b6be692fc Refs #16614 -- Prevented database errors from being masked by cursor close.
When an error occurred during the cursor.execute statement, the cursor
is closed. This operation did not fail with client-side cursors. Now,
with server-side cursors, the close operation might fail (example
below). The original error should be raised, not the one raised by
cursor.close(), this is only clean-up code.

For example, one can attempt to create a named cursor for an invalid
query. psycopg will raise an error about the invalid query and the
server-side cursor will not be created on PostgreSQL. When the code
attempts to cursor.close(), it asks psycopg to close a cursor that was
not created. pyscopg raises a new error: psycopg2.OperationalError:
cursor "_django_curs_140365867840512_20" does not exist.
2017-01-14 07:13:00 -05:00
Simon Charette 973cfd2ef5 Refs #20483 -- Implemented cascaded flush on Oracle.
The initial implementation added support for PostgreSQL but it is also required
on Oracle (13b7f299de).

Thanks Mariusz Felisiak for the foreign key retreival queries.
2017-01-13 08:50:03 -05:00
François Freitag f3b7c05936 Refs #16614 -- Made QuerySet.iterator() use server-side cursors on PostgreSQL.
Thanks to Josh Smeaton for the idea of implementing server-side cursors
in PostgreSQL from the iterator method, and Anssi Kääriäinen and Kevin
Turner for their previous work. Also Simon Charette and Tim Graham for
review.
2017-01-11 09:25:37 -05:00
Ed Morley 7156a6c9c4 Fixed #27717 -- Allowed migration optimization across AlterModelOptions. 2017-01-10 18:38:48 -05:00
David Szotten 7a6863c338 Fixed #27690 -- Removed time.sleep(1) before dropping the test database.
Uncertain if this is needed, but no failures have appeared so far.
2017-01-06 15:28:22 -05:00
anabelensc 1c12df4aa6 Fixed #25912 -- Added binary left/right shift operators to F expressions.
Thanks Mariusz Felisiak for review and MySQL advice.
2017-01-03 14:15:46 -05:00
Mariusz Felisiak fd2f7e4767 Fixed #27681 -- Fixed binary &/| operators for negative values on MySQL. 2017-01-03 12:41:44 -05:00
Josh Smeaton 26c9f529c9 Refs #27632 -- Simplified params dict creation for Oracle (#7772) 2017-01-01 12:39:03 +11:00
Andrew Nester 69b7d4b116 Fixed #27458 -- Fixed invalid sequence/index names when using "USER"."TABLE" db_table on Oracle. 2016-12-30 17:11:12 -05:00
Mariusz Felisiak 7d14889aa3 Fixed #27615 -- Used timedeltas as arguments to Oracle database driver.
Removed unused DatabaseFeatures.driver_supports_timedeltas workaround.
2016-12-29 15:49:18 -05:00
Tim Graham fae56427e1 Fixed #27649 -- Bumped required cx_Oracle to 5.2.
Removed obsolete workarounds from 1aa4889808
and dcf3be7a62.
2016-12-29 12:45:25 -05:00
Adam Chainz 391c450fba Refs #25415 -- Made MySQL backend skip field validation of unsupported models. 2016-12-29 12:01:48 -05:00
Florian Apolloner 00c7bfadf4 Removed unused enumerate. 2016-12-29 14:55:17 +01:00
Simon Charette 813805833a Fixed #27631 -- Prevented execution of transactional DDL statements when unsupported.
Executing a DDL statement during a transaction on backends that don't support
it silently commits, leaving atomic() in an incoherent state.

While schema_editor.execute() could technically be used to execute DML
statements such usage should be uncommon as these are usually performed through
the ORM. In other cases schema_editor.connection.execute() can be used to
circumvent this check.

Thanks Adam and Tim for the review.
2016-12-28 19:43:32 -05:00
Mariusz Felisiak 4579c3f6b8 Refs #27632 -- Unified query parameters by their types and values on Oracle.
Fixed Python 2 regression in 6dbe56ed78.

Thanks Simon Charette for the implementation idea.
2016-12-28 17:20:42 -05:00
Tim Graham e3e80da7a5 Fixed #27651 -- Allowed M2M to concrete and proxy through model. 2016-12-28 12:48:17 -05:00
Mariusz Felisiak 6dbe56ed78 Fixed #27632 -- Unified query parameters by their values on Oracle. 2016-12-28 08:14:14 -05:00
Simon Charette cd7efa2033 Fixed #25492 -- Checked deferred foreign key constraints before dropping them.
This allows running foreign key data and schema altering operations in the
same migration on PostgreSQL.

Thanks Tim for review.
2016-12-24 13:53:11 -05:00
Peter Inglesby a4cac17200 Fixed #27498 -- Fixed filtering on annotated DecimalField on SQLite. 2016-12-24 10:38:48 -05:00
Adam Chainz 8d94d575f8 Used @cached_property in RawQuerySet. 2016-12-23 10:12:48 -05:00
Adam Chainz 6ebf8f9057 Refs #27624 -- Made QuerySet._prefetch_related_lookups immutable. 2016-12-23 09:58:22 -05:00
Andrey Kuzminov b8741c0058 Refs #18823 -- Corrected field name in an m2m manager error message. 2016-12-23 09:31:26 -05:00
Tim Graham 09a7f121b5 Removed unneeded values in NullBooleanField.formfield().
These values are duplicated in the super().
2016-12-20 07:54:54 -05:00
Mariusz Felisiak cc0bb07013 Refs #19884 -- Removed DatabaseFeatures.can_introspect_max_length.
Unused (always True) after 3e43d24ad3.
2016-12-19 16:16:11 -05:00
Mariusz Felisiak 3e43d24ad3 Refs #19884 -- Added CharField max_length introspection on Oracle. 2016-12-19 08:29:42 -05:00
Adam Chainz d2a26c1a90 Optimized Model instantiation a bit.
* Avoid some unnecessary attribute lookups, e.g. access signals directly rather than from module
* Alias some repeat accesses inside the method to use the slightly faster local lookups
* Use tuple to iterate remaining kwargs as it's faster to construct
* Cache Field.get_default() to avoid running through all the logic on every call
* Use a cached list of the properties on the model class to avoid repeat isinstance() calls
2016-12-15 13:42:44 -05:00
Morgan Aubert ef889d5b10 Fixed #27599 -- Fixed Field.__str__() crash for fields not attached to models. 2016-12-14 14:04:26 -05:00
Daniel Hillier 7da37699e8 Fixed #27594 -- Fixed select_related() with reverse self-referential OneToOneField.
Fixed definition of `klass_info['from_parent']` so that two models aren't
considered from a parent class if the model classes are the same.
2016-12-14 07:46:27 -05:00
Simon Charette ecd625e830 Fixed #27310 -- Stopped rendering apps in RenameModel.state_forwards.
Thanks Tim for the review.
2016-12-10 10:19:06 -05:00
Yohann Gabory 47ef8f31f3 Fixed #13312 -- Allowed specifying the order of null fields in queries.
Thanks Mariusz Felisiak for finishing the patch.
2016-12-08 09:54:07 -05:00
InvalidInterrupt 98359109eb Fixed #17002 -- Allowed using a ManyToManyField through model that inherits another. 2016-12-07 17:50:51 -05:00
Sergey Fedoseev f909fa84be Fixed #25708 -- Fixed annotations with geometry values. 2016-12-07 14:16:29 -05:00
Tim Graham dd99e69fa8 Refs #27025 -- Fixed Python 3.6 deprecation warning for empty model super() calls.
https://bugs.python.org/issue23722

Thanks Nick Coghlan for advice and review.
2016-12-05 19:37:23 -05:00
Mariusz Felisiak 2d259e6bad Refs #27324 -- Optimized DatabaseIntrospection.get_constraints() for foreign keys on Oracle. 2016-12-05 19:12:37 -05:00
Mariusz Felisiak b059ddf066 Fixed #27561 -- Added Oracle support for binary "or" operator.
Removed DatabaseFeatures.supports_bitwise_or feature (unused, always True).
2016-12-02 16:59:39 -05:00
Keda87 48826aa541 Fixed #27546 -- Removed hardcoded class names in __repr__() methods. 2016-12-01 08:11:09 -05:00
Mariusz Felisiak e17f40f4b5 Refs #24245 -- Added introspection for database defaults on Oracle. 2016-11-30 11:21:57 -05:00
Lex Berezhny 1a9bd75bfa Refs #27358 -- Fixed system check crash with an empty FileField.upload_to. 2016-11-30 10:07:42 -05:00
Henry Dang 7cddd8a02e Fixed #27358 -- Added a system check to prevent FileField's upload_to from starting with a slash.
Thanks Frank Bijlsma for the initial patch.
2016-11-29 16:12:24 -05:00
Andrew Nester ade52ef71f Fixed #27544 -- Fixed QuerySet.update(dt=F('dt') + timedelta) crash on SQLite. 2016-11-29 12:23:44 -05:00
Adam Chainz 95238a7de8 Fixed #27321 -- Added detection for table case name sensitivity on MySQL. 2016-11-28 13:29:21 -05:00
Mads Jensen aa2cb4c622 Refs #26327 -- Renamed JsonAgg to JSONBAgg.
Thanks to Christian von Roques for the report.
2016-11-28 06:57:01 -05:00
Adam Chainz 6252fd6314 Fixed #27532 -- Deprecated Model._meta.has_auto_field 2016-11-25 13:24:11 -05:00
Daniel Hahler eb42d8d5d9 Fixed grammar in sqlite's DatabaseOperations.bulk_batch_size()'s docstring. 2016-11-25 07:50:59 -05:00
Adam Chainz 92bbef8b9e Improved the way Model.save() skips the auto_field.
Identity comparison is quicker than isinstance(), and it avoids coupling
between Model and AutoField.
2016-11-24 06:01:36 -05:00
Adam Chainz e044026dce Fixed #27499 -- Made Prefetches pickle without evaluating their QuerySet. 2016-11-23 11:23:14 -05:00
Tim Graham 2e5fbe889f Cleaned up some __getstate__() docstrings. 2016-11-23 09:45:21 -05:00
Mariusz Felisiak b63d0c54b0 Fixed #24959 -- Fixed queries using negative timedeltas on MySQL and Oracle. 2016-11-23 09:10:47 -05:00
Mark Young 2742901ac2 Fixed #27504 -- Allowed using the ORM after an error and rollback when autocommit is off. 2016-11-23 08:42:19 -05:00
Quentin Fulsher f62abfc03d Fixed #27295 -- Added a system check to prohibit model names that start or end with an underscore or contain double underscores. 2016-11-22 10:14:10 -05:00
Adam Chainz 74742aa956 Fixed #27512 -- Removed unused code in Model.__init__(). 2016-11-20 19:39:32 -05:00
Adam Chainz 9d4246419c Refs #26207 -- Removed obsolete comments about deferred model classes. 2016-11-20 18:22:13 -05:00
Adam Chainz cc1f6f26b6 Fixed #27514 -- Tested Model.__init__ excessive number of fields. 2016-11-20 13:21:59 -05:00
Simon Charette 31a56e30cf Fixed #27407 -- Made Model.delete(keep_parents=True) preserve parent reverse relationships.
Thanks Tim for the review.
2016-11-15 20:16:06 -05:00
Ramin Farajpour Cami 0a63ef3f61 Fixed #27463 -- Fixed E741 flake8 warnings. 2016-11-14 17:40:28 -05:00
Sergey Fedoseev c7bfcd2f37 Fixed #27481 -- Made SQLite return annotated boolean values as boolean, not integer.
Thanks Simon Charette for review.
2016-11-14 14:47:20 -05:00
Ramin Farajpour Cami 967be82443 Fixed E305 flake8 warnings. 2016-11-14 12:30:46 -05:00
Mads Jensen 1446902be4 Fixed #25240 -- Added ExtractWeek and exposed it through the __week lookup.
Thanks to Mariusz Felisiak and Tim Graham for review.
2016-11-11 08:01:40 -05:00
Tim Graham ac0cf97cb4 Removed redundant DateTimeField.register_lookup()s.
DateTimeField inherits these lookups from DateField.
2016-11-10 10:15:56 -05:00
Mariusz Felisiak dacef9137f Refs #27420 -- Removed exception hiding in Oracle test user creation during --keepdb.
If the test user creation fails here, _create_test_db() would return without
switching to the test user which caused the tests to run using the main
connection instead of the test user.
2016-11-08 16:53:52 -05:00
Mariusz Felisiak c4b04e1598 Fixed #27420 -- Quoted the Oracle test user password in queries. 2016-11-08 16:30:22 -05:00
Maxime Lorant cb3fb34b86 Fixed #27378 -- Added support for serialization of uuid.UUID in migrations.
Thanks Yuriy Korobko for the initial patch and Tobias McNulty for review.
2016-11-06 13:53:00 +01:00
Saulius Žemaitaitis f28d29e8b7 Fixed #27372 -- Fixed introspection of SQLite foreign keys with spaces in DDL.
Thanks samuller for the report and initial patch.
2016-11-06 10:13:32 +01:00
Adam Chainz c7dddc01d6 Fixed #27441 -- Improved SQL for 'DROP COLUMN' on MySQL
'CASCADE' is an undocumented no-op in MySQL, so to avoid confusion Django no longer outputs it.
2016-11-05 22:23:57 +01:00
Marti Raudsepp da7910d483 Fixed CVE-2016-9013 -- Generated a random database user password when running tests on Oracle.
This is a security fix.
2016-11-01 09:30:57 -04:00
Tim Graham 2f9861d823 Fixed #27148 -- Fixed ModelMultipleChoiceField crash with invalid UUID. 2016-10-31 15:21:05 -04:00
Michael Scott ec9ed07488 Fixed #27188 -- Allowed using unique=True with FileField.
Thanks Tim Graham for the initial patch.
2016-10-28 20:11:03 -04:00
Aymeric Augustin fd748c42a9 Simplified AppConfig.import_models().
Since AppConfig now has a reference to its parent Apps registry,
it can look up the models there instead of receiving them in argument.
2016-10-28 18:43:45 -04:00
Aymeric Augustin efcb7e1ebf Modified readiness check in AppConfig.get_model(s).
It was inconsistent with the equivalent check in Apps.get_model(s)
because I made incorrect assumptions when I wrote that code and
needlessly complicated readiness checks.

This is a backwards-incompatible change.
2016-10-28 18:42:29 -04:00
Tim Graham 1bc249c2a6 Fixed #20939 -- Simplified query generation by converting QuerySet to Query.
Thanks Anssi Kääriäinen for the initial patch and Anssi, Simon Charette,
and Josh Smeaton for review.
2016-10-28 11:20:23 -04:00
Tim Graham 414ad25b09 Fixed #27327 -- Simplified time zone handling by requiring pytz. 2016-10-27 08:53:20 -04:00
Adam Chidlow f734e2d4b2 Fixed #27334 -- Allowed FileField to move rather than copy a file.
When a FileField is set to an instance of File that is not also an
instance of FieldFile, pre_save() passes that object as the contents to
Storage.save(). This allows the file to be moved rather than copied
to the upload destination.
2016-10-26 12:25:30 -04:00
David Barragán Merino b3bd3aa07c Fixed #27385 -- Fixed QuerySet.bulk_create() on PostgreSQL when the number of objects is a multiple plus one of batch_size. 2016-10-25 19:21:08 -04:00
Marti Raudsepp 51fbe2a60d Updated postgresql.org links to https and made them canonical. 2016-10-25 11:43:32 -04:00
Tim Graham 19f1321fa4 Removed unused loop in Query.change_aliases().
Unknown if it was ever used.
2016-10-24 11:27:41 -04:00
François Freitag 86bb9a0502 Refs #20888 -- Fixed index ordering introspection on PostgreSQL 9.6. 2016-10-17 07:16:13 -04:00
Tim Graham 50864b402b Removed unused branch in ModelIterable.__iter__().
Unknown if it was ever used.
2016-10-15 10:19:47 -04:00
Tim Graham 5d1941adcf Removed unused 'field' argument to DeleteQuery.delete_batch().
Unused since a170c3f755.
2016-10-15 10:19:02 -04:00
Tim Graham 274b227796 Removed DatabaseFeatures.can_combine_inserts_with_and_without_auto_increment_pk.
Unused (always False) after 29132ebdef.
2016-10-14 17:18:28 -04:00
Tim Graham 8997750c43 Removed unused QuerySet.value_annotation attribute.
Unused since 5008a4db44.
2016-10-14 16:46:37 -04:00
Mariusz Felisiak 5a772a0b7b Fixed #27324 -- Simplified DatabaseIntrospection.get_constraints() on Oracle. 2016-10-14 13:59:13 -04:00
Tim Graham b679a3cdb1 Tested QuerySet compatibility check.
cdfdcf4b70 missed this test.
2016-10-14 08:51:04 -04:00
Tim Graham f2dc6b3a99 Removed unused InsertQuery.clone().
Unknown if it was ever needed.
2016-10-13 16:58:43 -04:00
Tim Graham 3b2db6ec12 Removed unneeded try/except in Query.names_to_path(). 2016-10-13 16:56:54 -04:00
Tim Graham df1796b13f Removed unused branch in SQLUpdateCompiler.as_sql().
Unknown if it was ever needed.
2016-10-13 16:56:26 -04:00
Tim Graham 419de7b00d Removed unused branch in Query.change_aliases().
Unused since 0c7633178f.
2016-10-13 14:35:10 -04:00
Tim Graham 816eae3508 Removed unused EmptyResultSets in SQLCompilers.
Unused since ed1bcf0515.
2016-10-13 12:12:58 -04:00
João Sampaio 74a575eb72 Fixed #24607 -- Serialized natural keys in multi-table inheritance models. 2016-10-12 20:04:57 -04:00
Mariusz Felisiak 794f866cec Fixed #27323 -- Optimized Oracle introspection by using USER_SEQUENCES instead of USER_CATALOG. 2016-10-12 18:58:33 -04:00
Tim Graham a3a10f8abe Removed unused SubqueryConstraint.relabel_aliases() and clone() methods.
Unused since b68212f539.
2016-10-12 08:18:56 -04:00
Nick Pope f1664a2734 Replaced '__' with LOOKUP_SEP constant. 2016-10-11 11:14:06 -04:00
Tim Graham 46a3d7604e Fixed gis_tests.geoapp when run in isolation.
"from django.db.models import *" in contrib/gis/db/models/__init__.py could
obscure gis's functions.py resulting in exceptions like:
"module 'django.db.models.functions' has no attribute 'Union'".
2016-10-10 10:13:01 -04:00
Claude Paroz 979ea95608 Fixed #27300 -- Made makemigrations --dry-run output a string (no bytes)
Thanks Markus Holtermann for the report and the review.
2016-10-06 11:41:35 +02:00
Tim Graham 0083a4c8e9 Refs #18974 -- Deprecated @models.permalink() decorator. 2016-10-04 14:39:49 -04:00
François Freitag 8ac115c730 Fixed #27193 -- Preserved ordering in select_for_update subqueries. 2016-10-04 10:46:29 -04:00
François Freitag 1db1f74617 Refs #27118 -- Reallowed using pk in QuerySet.get/update_or_create(). 2016-10-04 10:10:39 -04:00
Simon Charette 040bd7c938 Fixed #27279 -- Fixed a migration performance regression related to RenameModel operations.
Thanks Trac alias mtomiyoshi for the report, Marten Kenbeek for the initial
patch and Tim for the review.
2016-10-04 08:35:15 -04:00
Mariusz Felisiak 6e4e0f4ce4 Fixed #26541 -- Allowed MySQL transaction detection to work without table creation. 2016-10-01 10:01:44 -04:00
Tim Graham 9819676676 Updated links to the current version of MySQL docs. 2016-09-30 09:14:17 -04:00
Tim Graham a44fc008c4 Fixed #27217 -- Fixed crash in CreateModel optimization with models that use mixins.
Thanks Simon Charette for review.
2016-09-28 10:04:52 -04:00
Zapelini 62543260dd Fixed #27282 -- Allowed using an integer DATABASES['PORT'] for Oracle. 2016-09-27 15:01:30 -04:00
Mariusz Felisiak 14986a0b9d Fixed #27268 -- Restored an invalid related field lookup error message in QuerySet filtering. 2016-09-27 15:00:36 -04:00
Tim Graham 419b6ec7d0 Removed unused branch in SQLCompiler.as_subquery_condition().
Unused since dcdc579d16.
2016-09-27 09:58:53 -04:00
Adam Chainz b29c6c96c7 Removed missing name in django.db __all__.
'backend' hasn't existed since 051c666aca.
2016-09-26 19:04:18 -04:00
Tim Graham c47f8a9d4d Removed obsolete lines in DeferredAttribute.__get__().
Obsolete as of c21e86ab9e.
2016-09-26 18:47:07 -04:00
Adam Chainz 85f2bba7eb Removed DatabaseError and IntegrityError declarations from database backends.
Unused since 11ee9746a0.
2016-09-26 18:31:41 -04:00
François Freitag a5e13a0b92 Fixed #27118 -- Made QuerySet.get_or_create()/update_or_create() error for a non-field in their arguments. 2016-09-24 20:16:16 -04:00
Tim Graham 5d55a26019 Removed unused FieldGetDbPrepValueMixin.get_prep_lookup_value().
Unused since its introduction in 4f138fe5a4.
2016-09-24 17:30:43 -04:00
Tim Graham f4bde7d9a1 Removed unused Prefetch.get_current_prefetch_through().
Unused since its introduction in f51c1f5900.
2016-09-23 17:11:15 -04:00
Simon Charette 658f1e81a7 Removed unnecessary casting when using builtin lookups on PostgreSQL. 2016-09-22 22:19:37 -04:00
Jani Tiainen 7a2c27112d Fixed #27159 -- Prevented pickling a query with an __in=inner_qs lookup from evaluating inner_qs. 2016-09-22 19:59:11 -04:00
Dmitry Medvinsky 1a9f6db5ff Fixed #27219 -- Changed cx_Oracle client encoding to AL32UTF8 to allow 4-byte characters. 2016-09-19 20:19:57 -04:00
akki 358c6f21f8 Fixed #27165 -- Removed unnecessary CreateModel(... 'indexes': []) in migrations. 2016-09-19 10:17:16 -04:00
Tim Graham 8119b679eb Refs #27025 -- Fixed "invalid escape sequence" warnings in Python 3.6.
http://bugs.python.org/issue27364
2016-09-17 15:44:06 -04:00
François Freitag 631ef6b272 Made FieldError/FieldDoesNotExist messages uniform across Python versions.
Removed possible u'' prefixes on Python 2.
2016-09-17 09:29:14 -04:00
Chris Lamb 9027e6c8a3 Fixed #27235 -- Removed some usage of mutable default arguments. 2016-09-16 15:48:08 -04:00
Simon Charette 32c0d823e5 Used a database feature to prevent the jsonb test model from being migrated.
Thanks Tim for the review.
2016-09-12 20:07:35 -04:00
Claude Paroz a1ad896422 Refs #27098 -- Added introspection for expression-based index on PostgreSQL
Also test it on PostGIS raster fields.
2016-09-12 09:26:33 +02:00
Claude Paroz 0c6fbea59b Reformatted PostgreSQL query for better readability 2016-09-12 09:26:33 +02:00
Claude Paroz d389125606 Fixed #27098 -- Deprecated DatabaseIntrospection.get_indexes
Thanks Akshesh <aksheshdoshi@gmail.com> for help with the PostgreSQL query.
Thanks Tim Graham for the review.
2016-09-12 09:26:33 +02:00
Tim Graham e7abb5ba86 Fixed #27204 -- Made clashing m2m intermediary table checks ignore unmanaged models. 2016-09-09 19:18:37 -04:00
Mikhail Denisenko bae64dd0f1 Fixed #27062 -- Eased implementing select_for_update() on MSSQL. 2016-09-09 11:57:38 -04:00
Simon Charette aca939b6e5 Fixed #27195 -- Stopped dropping default when adding a nullable column.
Thanks Rob Golding from Zapier for the report.
2016-09-09 00:48:50 -04:00
Chris Jerdonek 7ca3b391b6 Fixed #27170 -- Added DatabaseWrapper class attributes to ease subclassing. 2016-09-08 16:33:36 -04:00
Simon Charette 0bbab97c28 Refs #15250 -- Removed an obsolete comment regarding MTI cascade deletion. 2016-09-08 00:20:54 -04:00
Markus Gerards 2b64ff68cc Fixed #27180 -- Fixed a crash in MySQL checks where SELECT @@sql_mode doesn't return a result. 2016-09-07 11:15:41 -04:00
Claude Paroz 2ced2f785d Replaced smart_* by force_* calls whenever possible
The smart_* version should only be used when a lazy string should keep
its lazy status.
2016-09-03 13:46:41 +02:00
Akshesh dbccf163b6 Fixed #27097 -- Added index type introspection to built-in db backends. 2016-09-02 21:14:12 -04:00
Marcos Vives Del Sol d6b9aab37c Fixed #25476 -- Allowed PostgreSQL introspection to work regardless of table owner. 2016-09-02 20:11:23 -04:00
Tim Graham 098c07a032 Fixed #27142, #27110 -- Made makemigrations consistency checks respect database routers.
Partially reverted refs #27054 except for one of the tests as this
solution supersedes that one.

Thanks Shai Berger for the review.
2016-09-01 16:19:29 -04:00
Tim Graham 96ee486ea4 Fixed #27081 -- Allowed migrations to serialize methods on pypy. 2016-08-30 21:47:34 -04:00
Simon Charette 0d7929266e Fixed #25109 -- Stopped silencing explicitly specified migration modules import errors.
Thanks Tim for the review.
2016-08-30 19:50:42 -04:00