Commit Graph

3899 Commits

Author SHA1 Message Date
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
Claude Paroz a72411e140 Removed double semicolon in SQL query 2016-08-30 19:12:55 +02:00
Akshesh 4c7bf83cde Refs #27097, #27098 -- Moved PostgreSQL index type introspection to get_constraints(). 2016-08-30 08:48:55 -04:00
Pavel Sutyrin 3fe92f4477 Clarified topological_sort_as_sets() docstring. 2016-08-29 13:58:39 -04:00
Berker Peksag a02b5848ae Replaced property() usage with decorator in several places. 2016-08-25 20:06:22 -04:00
Claude Paroz 066283a11d Removed unneeded smart_text 2016-08-25 22:49:31 +02:00
Mattias Loverot 2315114090 Fixed #27067 -- Deprecated string_concat() in favor of format_lazy(). 2016-08-25 16:12:40 -04:00
Berker Peksag 3c97ba2a0d Replaced property() usage with decorator in a couple places. 2016-08-24 17:23:16 -04:00
Simon Charette d5c4ea5246 Fixed #27100 -- Included already applied migration changes in the pre-migrate state.
Refs #24100.

Thanks Tim for the review.
2016-08-24 01:17:48 -04:00
Simon Charette d1757d8df4 Fixed #27044 -- Included already applied migration changes in the post-migrate state when the execution plan is empty.
Refs #24100.

Thanks tkhyn for the report and Tim for the review.
2016-08-24 01:17:18 -04:00
Tim Graham ad25fe7350 Fixed #27089 -- Added database alias to InconsistentMigrationHistory message. 2016-08-23 17:39:58 -04:00
Chris Jerdonek a3db480393 Fixed #27061 -- Added a TEST['TEMPLATE'] setting for PostgreSQL. 2016-08-23 15:08:20 -04:00
Claude Paroz 00bb47b58f Fixed #27096 -- Fixed primary key introspection for sqlite3 backend 2016-08-20 15:57:17 +02:00
Matthew Wilkes 4f138fe5a4 Fixed #22288 -- Fixed F() expressions with the __range lookup. 2016-08-19 13:40:56 -04:00
Ian Foote 39f35d4b9d Fixed #25871 -- Added expressions support to QuerySet.values(). 2016-08-18 16:05:15 -04:00
Loïc Bistuer d4eefc7e2a Fixed #27073 -- Removed duplicated managers in `Model._meta.managers`. 2016-08-19 01:24:45 +07:00
Jim Nicholls 76ab885118 Fixed #27054 -- Fixed makemigrations crash with a read-only database. 2016-08-18 08:27:40 -04:00
Chris Jerdonek 3d0a3c5fff Fixed #27077 -- Made SQLite's in-memory database checks DRYer. 2016-08-17 20:34:18 -04:00
Chris Jerdonek 49fcbe73c5 Fixed #27078 -- Simplified "if" logic in SQLite's _get_test_db_name(). 2016-08-17 16:20:01 -04:00
Akshesh c969b17ad8 Refs #26709 -- Added type check for models.Index fields argument. 2016-08-16 09:53:50 -04:00
Akshesh a71724cd04 Refs #26709 -- Added index name to AddIndex.describe(). 2016-08-16 09:11:33 -04:00
Ian Foote 698be78d74
Fixed #24854 -- Refactored QuerySet._values
Added django.db.models.sql.query.Query.set_values() method to handle
query mutation.
2016-08-16 10:03:40 +10:00
Claude Paroz 21aec54296 Removed unnecessary registration of psycopg2 unicode extensions on Python 3 2016-08-15 20:57:57 +02:00
Akshesh 6e07ec3f65 Fixed #27030 -- Added contrib.postgres.indexes.GinIndex. 2016-08-12 18:37:03 -04:00
Akshesh 2f19306a12 Refs #27030 -- Added index type introspection on PostgreSQL. 2016-08-12 16:58:40 -04:00
Akshesh 311a8e8d50 Fixed #20888 -- Added support for column order in class-based indexes. 2016-08-12 15:52:16 -04:00
Akshesh f842d1011c Refs #20888 -- Added index order introspection. 2016-08-12 11:51:09 -04:00
Akshesh 324c1b432a Fixed #24442 -- Improved SchemaEditor's index name truncation. 2016-08-11 14:36:31 -04:00
Ryan P Kilby 7aeb7390fc Fixed #26891 -- Fixed lookup registration for ForeignObject. 2016-08-11 14:16:48 -04:00
Chris Sinchok ac1975b18b Fixed #13809 -- Made FieldFile.open() respect its mode argument. 2016-08-09 12:53:18 -04:00
Simon Charette b8e6e1b43b
Fixed #26500 -- Added SKIP LOCKED support to select_for_update().
Thanks Tim for the review.
2016-08-08 12:01:43 -04:00
Johannes Dollinger 46509cf13d Moved EmpytResultSet to django.core.exceptions.
This removes the need for some inner imports.
2016-08-08 10:43:34 -04:00
Johannes Dollinger c002a0d39f Fixed #26517 -- Fixed ExpressionWrapper with empty queryset. 2016-08-08 10:43:33 -04:00
Johannes Dollinger 1410616e0e Fixed #26433 -- Fixed Case expressions with empty When. 2016-08-08 10:43:33 -04:00
Sjoerd Job Postmus 3246d2b4bb Fixed #27026 -- Fixed state initialization of bulk_create() objects if can_return_ids_from_bulk_insert. 2016-08-06 10:24:57 -04:00
Akshesh 6a8372e6ec Fixed #26808 -- Added Meta.indexes for class-based indexes.
* Added the index name to its deconstruction.
* Added indexes to sqlite3.schema._remake_table() so that indexes
  aren't dropped when _remake_table() is called.

Thanks timgraham & MarkusH for review and advice.
2016-08-05 18:12:51 -04:00
Jarek Glowacki d117567c7d Fixed #27004 -- Made migrations consistency check ignore unapplied squashed migrations. 2016-08-05 18:01:55 -04:00
Yoong Kang Lim d30febb4e5 Fixed #26706 -- Made RelatedManager modification methods clear prefetch_related() cache. 2016-08-05 13:32:27 -04:00
Claude Paroz 272eccf7ff Fixed #26983 -- Fixed isnull filtering on ForeignKey with to_field
Thanks weidwonder for the report.
2016-08-04 16:05:21 +02:00
Akshesh b92c6b7d56 Refs #26709 -- Replaced Index.get_name() with set_name_with_model().
This removes the dependency of the Index class on its 'model'
attribute.
2016-08-02 14:21:41 -04:00
Tim Graham d95c669c29 Fixed #26991 -- Fixed a crash in MySQL where SQL_AUTO_IS_NULL doesn't return a result. 2016-08-02 10:52:31 -04:00
Adam Chainz 4b1c9708d6 Fixed #26966 -- Made MySQL backend skip defaults for JSON columns
Thanks mcgeeco for reporting, and claudep and timgraham for review.
2016-08-01 13:51:25 -04:00
Tim Graham 5fa4370543 Refs #25550 -- Corrected deprecation message for assigning M2M relations. 2016-07-30 20:50:09 -04:00
premanand lakshmanan 5da7e3f7fd Fixed #26114 -- Fixed AlterModelTable.describe() if db_table is None. 2016-07-28 10:33:14 -04:00
Anderson Resende 0d1218896f Fixed #26950 -- Removed obsolete DatabaseOperations SQL methods.
Unused as of 2b039d966f.
2016-07-27 07:34:44 -04:00
Kevan Swanberg 17a0a6667c Refs #26796 -- Fixed ManyToManyField's limit_choices_to warning without a through model. 2016-07-21 14:29:03 -04:00
Claude Paroz 3ea7167bb5 Refs #24928 -- Added introspection support for UUIDField 2016-07-20 17:27:29 +02:00
Simon Charette 271bfe65d9
Fixed #26916 -- Fixed prefetch_related when using a cached_property as to_attr.
Thanks Trac alias karyon for the report and Tim for the review.
2016-07-19 16:05:07 -04:00
akki 767849b765 Removed unnecessary looping in sqlite3 SchemaEditor. 2016-07-18 08:47:30 -04:00
Akshesh bdba0fc195 Fixed typo in autodetector method name. 2016-07-17 15:18:39 -04:00
Tim Graham 7c33aa8a87 Fixed #26900 -- Fixed crash accessing deferred FileFields. 2016-07-16 08:22:24 -04:00
Jon Dufresne 3f76d1402d Refs #26889 -- Refactored SchemaEditor to allow backend specific indexes. 2016-07-15 10:34:37 -04:00
Marc-Aurèle Brothier f8bfa80680 Fixed #26868 -- Changed MySQL version detection to use a query.
Workaround a bug with MariaDB and MySQL native client not stripping the
`5.5.5-` prefix.
2016-07-15 10:05:03 -04:00
Jensen Cochran d44afd8892 Fixed #26804 -- Fixed a race condition in QuerySet.update_or_create(). 2016-07-14 12:10:19 -04:00
Tim Graham 944e66cb1d Reverted "Fixed #25388 -- Added an option to allow disabling of migrations during test database creation"
This reverts commit 157d7f1f1d since it
disables migrations all the time, not just during tests.
2016-07-14 09:21:28 -04:00
Jon Dufresne 2e4cfcd2b9 Fixed #26889 -- Fixed missing PostgreSQL index in SchemaEditor.add_field(). 2016-07-13 14:33:54 -07:00
Kenneth 841cb45847 Fixed #26884 -- Evaluated callables in QuerySet.update_or_create()'s defaults when updating. 2016-07-12 22:09:53 -04:00
Jon Dufresne b84ecaa736 Fixed #26088 -- Made autodector detect changing proxy model to MTI. 2016-07-12 21:45:17 -04:00
Andrey Fedoseev 81963b37a9 Fixed #17657 -- Made ModelForm respect ModelMultipleChoiceField's to_field_name.
Follow up to 67d984413c.
2016-07-12 16:20:06 -04:00
Julien Hartmann f4afb85d7e Fixed #26749 -- Preserved behavior of use_for_related_field during deprecation. 2016-07-11 13:30:44 -04:00
Loïc Bistuer dab83e5ba1 Fixed #26881 -- Fixed duplicate managers in migrations.
When both parent and child models had managers with the same name and
a migrations opt-in both were added to the migration state.
2016-07-09 17:52:52 +07:00
Anderson Resende ba53da894f Fixed #26796 -- Added a system check for m2m fields with ignored limit_choices_to. 2016-07-08 19:37:40 -04:00
Simon Charette 8a4f017f45 Fixed #26348 -- Added TruncTime and exposed it through the __time lookup.
Thanks Tim for the review.
2016-07-08 12:35:34 -04:00
Simon Charette 082c52dbed Refs #25774, #26348 -- Allowed Trunc functions to operate with time fields.
Thanks Josh for the amazing testing setup and Tim for the review.
2016-07-08 12:35:34 -04:00
Simon Charette c4a876a0c1 Refs #17260 -- Prevented Oracle timezone conversion from stripping microseonds. 2016-07-08 12:35:33 -04:00
Jon Dufresne 9356f63a99 Fixed #25317, #26090 -- Fixed swapping combinations of unique and db_index during migrations. 2016-07-07 20:29:08 -04:00
Akshesh fc3ac65735 Refs #26709 -- Checked allow_migrate_model() in Add/RemoveIndex operations. 2016-07-07 10:37:39 -04:00
Akshesh 52442898e7 Refs #26709 -- Added 'model' argument to SchemaEditor.add/remove_index()
This removes the dependency of the Index class on its model attribute
when a name is passed to it.

Thanks to Markush for discussions.
2016-07-07 10:06:55 -04:00
Jon Dufresne 3410820460 Fixed #26833 -- Fixed SchemaEditor._constraint_names() to handle features.uppercases_column_names. 2016-07-07 08:09:42 -04:00
Akshesh f7e907115f Refs #26709 -- Added IndexOperation to avoid code duplication. 2016-07-07 07:35:26 -04:00
Akshesh b1e7d19d4c Refs #26709 -- Required a name for Indexes passed to AddIndex.
Thanks to Markush for discussions.
2016-07-07 07:31:23 -04:00
akki 2960e3a3a7 Fixed #26841 -- Avoid remake tables for altering togethers in sqlite3 (#6888)
alter_index_together and alter_unique_together no more use _remake_table method in sqlite3
2016-07-06 10:03:47 +02:00
Adam Dobrawy 92d323ccb5 Added package names to 'Error loading MySQLdb module' error. 2016-07-01 13:12:27 -04:00
Berker Peksag 12b4280444 Fixed #21548 -- Added FileExtensionValidator and validate_image_file_extension. 2016-06-30 09:08:50 -04:00
Andrew Nester baff4dd37d Fixed #25292 -- Fixed crash in ManyToManyField.through_fields check. 2016-06-30 08:53:38 -04:00
Jon Dufresne 16614dcd5c Fixed #25694 -- Removed incorrect _uniq suffix on index names during migrations. 2016-06-29 14:47:29 -04:00
David Sanders a84344bc53 Fixed #19513, #18580 -- Fixed crash on QuerySet.update() after annotate(). 2016-06-29 14:08:13 -04:00
Eduard Stepanov 49b4596cb4 Fixed #26786 -- Avoided redundant max value validators on integer fields. 2016-06-28 11:39:20 -04:00
Aaron Elliot Ross 6bf7964023 Fixed #26171 -- Made MySQL create an index on ForeignKeys with db_contraint=False.
Refactored "Prevented unneeded index creation on MySQL-InnoDB" (2ceb10f)
to avoid setting db_index=False.
2016-06-28 08:22:20 -04:00
Ben Demboski 2224a56631 Fixed #26784 -- Made ForeignKey.validate() pass `model` to router if model_instance=None. 2016-06-27 13:33:37 -04:00
Étienne BERSAC 03f6d272ab Fixed #26751 -- Made dbshell exit with the shell's error code. 2016-06-27 12:20:40 -04:00
Akshesh 156e2d59cf Fixed #26709 -- Added class-based indexes.
Added the AddIndex and RemoveIndex operations to use them in migrations.

Thanks markush, mjtamlyn, timgraham, and charettes for review and advice.
2016-06-27 10:41:01 -04:00
Simon Charette c2e62fd1ae Fixed #26781 -- Made table name case change a noop on SQLite.
SQLite disgresses from the SQL standard by ignoring case of quoted identifiers.

Thanks to laozzzi for the report and Tim for the review.
2016-06-21 16:37:06 -04:00
Loïc Bistuer 2eb7cb2fff Fixed #26643 -- Prevented unnecessary AlterModelManagers operations caused by the manager inheritance refactor.
This also makes migrations respect the base_manager_name and
default_manager_name model options.

Thanks Anthony King and Matthew Schinckel for the initial patches.
2016-06-20 12:55:57 -04:00
Tim Graham 9bf8d50a67 Fixed #26778 -- Fixed ModelSignal.connect() weak argument. 2016-06-18 20:45:38 -04:00
Tim Graham 7def55c3f6 Reverted "Fixed #26398 -- Made FieldFile.open() respect its mode argument."
This reverts commit a52a531a8b due to
regressions described in refs #26772.
2016-06-17 21:04:02 -04:00
Ville Skyttä 96f97691ad Fixed broken links in docs and comments. 2016-06-15 21:20:23 -04:00
Jon Dufresne 267dc4addd Fixed #4136 -- Made ModelForm save empty values for nullable CharFields as NULL.
Previously, empty values were saved as strings.
2016-06-13 09:14:36 -04:00
Berker Peksag 0bce2f102c Fixed #12810 -- Added a check for clashing ManyToManyField.db_table names. 2016-06-10 10:57:22 -04:00
Michal Petrucha 686a593aaa Fixed #26648 -- Added a system check for invalid related_query_name's containing underscores. 2016-06-09 11:57:32 -04:00
Michal Petrucha effb4ed6f5 Replaced a hardcoded LOOKUP_SEP in models/fields/__init__.py 2016-06-09 11:57:00 -04:00
Sergey Fedoseev 21130ce1a9 Fixed #26718 -- Added system check for existence of the fields specified by ForeignKey.to_field. 2016-06-09 10:19:09 -04:00
Tim Graham 908c26b079 Fixed typos in db/models/fields/related_descriptors.py 2016-06-07 08:53:05 -04:00
Paulo 1a2a7cc01e Fixed typo in db/models/fields/related_descriptors.py 2016-06-07 08:50:06 -04:00
Paulo 3e9f769fd1 Refs #15250 -- Added docstring for ForwardOneToOneDescriptor. 2016-06-07 07:22:32 -04:00
Sergey Fedoseev 7fc4c1db62 Fixed #26710 -- Made CreateModel.references_model() take app_label into account. 2016-06-06 11:49:45 -04:00
Simon Charette b484f167be Fixed #26712 -- Avoided unnecessary SET TIMEZONE queries on PostgreSQL.
A change of the USE_TZ or TIME_ZONE settings doesn't necessarily require a
change to the active connections' timezones.
2016-06-06 11:26:02 -04:00
Tim Graham e2296e7f0a Fixed #26667 -- Fixed a regression in queries on a OneToOneField that has to_field and primary_key=True.
Thanks Simon Charette for review.
2016-06-04 08:04:51 -04:00
mieciu 19ff506878 Fixed #26698 -- Fixed PostgreSQL dbshell crash on an empty database name. 2016-06-03 12:30:21 -04:00
Paulo 38575b007a Fixed #15250 -- Avoided extra query on some multi-table inheritance queries.
Thanks marekw2143 for the initial patch and carljm for support.
2016-06-03 10:18:24 -04:00
Will Koster 9899347641 Fixed #26638 -- Allowed callable arguments for QuerySet.get_or_create()/update_or_create() defaults. 2016-06-03 10:00:53 -04:00
Alex Hill 08014fe75b Fixed #26686 -- Fixed crash when registering model signals with abstract senders. 2016-06-02 14:34:01 -04:00
Simon Charette 53a5fb3cc0 Fixed #26676 -- Prevented prefetching to_attr from caching its result in through attr.
Thanks Ursidours for the report.
2016-05-31 14:32:58 -04:00
Vytis Banaitis f1e408ff40 Fixed #25044 -- Fixed migrations for renaming ManyToManyField's through model. 2016-05-30 10:17:45 -04:00
Tim Graham a4c20ae85b Refs #24227 -- Fixed crash of ManyToManyField.value_from_object() on unsaved model instances.
This behavior was removed in 67d984413c
but is needed to prevent a crash in formtools.
2016-05-28 15:41:47 -04:00
Alex Hill ff6c6feae1 Fixed #26642 -- Made ModelSignal.disconnect() work with lazy references. 2016-05-27 17:45:08 -04:00
Simon Charette 36d36818a3 Fixed #26647 -- Included the state of all applied migrations when migrating forward.
Thanks Jasper Maes for the detailed report.
2016-05-26 13:30:10 -04:00
Alex Hill 779bb82f51 Fixed #26421 -- Refactored ModelSignal to use Apps.lazy_model_operation() 2016-05-19 21:33:36 -04:00
Alex Hill 2ff7ef15b0 Refs #26421 -- Refactored Apps.lazy_model_operation() for better checks and tests 2016-05-19 21:33:36 -04:00
Tim Graham 546649f2d6 Fixed some newlines in imports per isort. 2016-05-19 11:05:44 -04:00
darius BERNARD a7ad473ad2 Fixed #26515 -- Fixed Query.trim_joins() for nested ForeignObjects. 2016-05-19 09:56:24 -04:00
Marti Raudsepp b9ae662c97 Fixed #26620 -- Made Model.refresh_from_db() fail when passed unknown kwargs. 2016-05-18 09:27:23 -04:00
Barthelemy Dagenais a5c8072ab1 Fixed #26627 -- Fixed on_commit callbacks execution order when callbacks make transactions. 2016-05-18 09:09:48 -04:00
Josh Smeaton 2a4af0ea43 Fixed #25774 -- Refactor datetime expressions into public API 2016-05-18 20:14:58 +10:00
Josh Smeaton 77b73e79a4 Refs #25774 -- Made Oracle truncate microseconds if USE_TZ=False.
The tests for this change are in the fix for #25774.
2016-05-18 20:14:58 +10:00
Philip Liberato 3630b49b55 Fixed #26613 -- Made sqlite3 optional in SchemaEditor.quote_value(). 2016-05-17 21:43:37 -04:00
boaz85@gmail.com 5f23f904af Fixed #14415 -- Used the test database name in BaseDatabaseCreation.test_db_signature(). 2016-05-17 21:35:36 -04:00
Loïc Bistuer ed0ff913c6 Fixed #10506, #13793, #14891, #25201 -- Introduced new APIs to specify models' default and base managers.
This deprecates use_for_related_fields.

Old API:

class CustomManager(models.Model):
    use_for_related_fields = True

class Model(models.Model):
    custom_manager = CustomManager()

New API:

class Model(models.Model):
    custom_manager = CustomManager()

    class Meta:
        base_manager_name = 'custom_manager'

Refs #20932, #25897.

Thanks Carl Meyer for the guidance throughout this work.
Thanks Tim Graham for writing the docs.
2016-05-17 12:07:22 +07:00
Loïc Bistuer 3a47d42fa3 Fixed #20932, #25897 -- Streamlined manager inheritance. 2016-05-17 02:29:22 +07:00
Aron Podrigal 85ef98dc6e Fixed #24305 -- Allowed overriding fields on abstract models.
Fields inherited from abstract base classes may be overridden like
any other Python attribute. Inheriting from multiple models/classes
with the same attribute name will follow the MRO.
2016-05-16 07:32:21 -04:00
Simon Charette f937c9ec97 Fixed #24100 -- Made the migration signals dispatch its plan and apps.
Thanks Markus for your contribution and Tim for your review.
2016-05-15 19:51:15 -04:00
Tim Graham cb4be0262a Removed unused code in AlterField.database_forwards().
This code added in 107c9f5453 isn't
used after 4ce7a6bc84.
2016-05-14 06:43:40 -04:00
Tim Graham 3642835bde Removed redundant code in QuerySet._batched_insert(). 2016-05-14 06:42:50 -04:00
Simon Charette c0118ff80b Refs #24201 -- Ignored order_with_respect_to private fields in migrations.
Thanks Tim for the review.
2016-05-13 15:43:23 -04:00
Tim Graham 67d984413c Refs #24227 -- Removed ManyToManyField special casing in model_to_dict(). 2016-05-11 10:12:59 -04:00
Raphael Gaschignard 8f6a1a1551 Fixed #26429 -- Added a timestamp to merge migration names.
This reduces the possibility of a naming conflict, especially after
squashing migrations.
2016-05-11 08:19:19 -04:00
Iacopo Spalletti 49c57f8565 Fixed #25005 -- Made date and time fields with auto_now/auto_now_add use effective default.
Thanks to Andriy Sokolovskiy for initial patch.
2016-05-09 07:48:40 -04:00
Ville Skyttä 413f3bb5c8 Replaced `six.callable` with `callable`. 2016-05-08 18:07:15 -04:00
Jarek Glowacki 509379a161 Fixed #25945, #26292 -- Refactored MigrationLoader.build_graph() 2016-05-08 13:53:26 +02:00
Markus Holtermann deeffde84a Fixed #26593 -- Leveraged deferrable_sql() in SchemaEditor 2016-05-07 01:21:00 +02:00
Markus Holtermann 3b383085fb Fixed #26555 -- Gave deconstructible objects a higher priority during serialization 2016-05-04 22:39:19 +02:00
Claude Paroz 388bb5bd9a Fixed #22936 -- Obsoleted Field.get_prep_lookup()/get_db_prep_lookup()
Thanks Tim Graham for completing the initial patch.
2016-05-04 20:02:01 +02:00
Ville Skyttä 575a9a791e Normalized "an SQL" spelling. 2016-05-03 19:30:48 -04:00
Simon Charette 7ec330eeb9 Refs #26565 -- Errored nicely when using Prefetch with a values() queryset.
Thanks Maxime Lorant for the report and Anssi for the suggestion.
2016-05-03 09:28:31 -04:00
Michal Petrucha 8a47ba679d Refs #16508 -- Made Model.__init__() aware of virtual fields.
It's no longer necessary for GenericForeignKey (and any other virtual fields)
to intercept the field's values using the pre_init signal.
2016-05-03 09:06:26 -04:00
Tim Graham eab5df12b6 Refs #22936 -- Moved more of Field.get_db_prep_lookup() to lookups. 2016-05-02 07:58:24 -04:00
Cristiano 914c72be2a Fixed #26058 -- Delegated os.path bits of FileField's filename generation to the Storage. 2016-04-30 17:22:40 -04:00
Anssi Kääriäinen 7f51876f99 Fixed #26207 -- Replaced dynamic classes with non-data descriptors for deferred instance loading. 2016-04-29 13:06:32 -04:00
Joshua Phillips 4681d65048 Fixed #26557 -- Converted empty strings to None when saving GenericIPAddressField. 2016-04-29 10:11:49 -04:00
Simon Charette f951bb78cb Refs #26521 -- Adjusted CreateModel bases validation to account for mixins.
Thanks Collin for the report.
2016-04-28 18:20:48 -04:00
Simon Charette a877a2f83d Refs #26521 -- Added the duplicated value to CreateModel validation messages.
Thanks Tim for the suggestion.
2016-04-27 16:17:22 -04:00
James Robert 417e083e55 Fixed #26521 -- Validated CreateModel bases, fields and managers for duplicates. 2016-04-27 12:43:56 -04:00
Tim Graham 1ba0b22a7a Refs #22936 -- Removed unused code in Field.get_db_prep_lookup(). 2016-04-25 08:31:32 -04:00
Tim Graham b454e2cbc9 Removed unused Q.clone().
Unused since afe0bb7b13.
2016-04-25 08:31:32 -04:00
Tim Graham 901dc90db0 Removed unused/untested Field.get_choices_default()/value_to_string() methods. 2016-04-25 08:05:27 -04:00
Tim Graham a755e0657e Removed unused BaseExpression.refs_aggregate().
Unused since afe0bb7b13.
2016-04-22 13:04:13 -04:00
Tim Graham 87338198e9 Fixed #26320 -- Deprecated implicit OneToOnField parent_link. 2016-04-22 12:59:41 -04:00
Tim Graham 6b0a25d9e2 Removed unused ForeignObject.attnames/get_defaults(). 2016-04-22 10:00:50 -04:00
Tim Graham 2da7f5afcf Removed unused ForeignObjectRel.get_choices() limit_to_currently_related argument.
Unused since its introduction in dc334a2ba8.
2016-04-22 08:45:41 -04:00
Marc Tamlyn 2d877da855 Refs #3254 -- Added full text search to contrib.postgres.
Adds a reasonably feature complete implementation of full text search
using the built in PostgreSQL engine. It uses public APIs from
Expression and Lookup.

With thanks to Tim Graham, Simon Charettes, Josh Smeaton, Mikey Ariel
and many others for their advice and review. Particular thanks also go
to the supporters of the contrib.postgres kickstarter.
2016-04-22 10:44:37 +01:00
Loïc Bistuer a885bca1df Fixed #26528 -- Allowed any iterable (e.g. tuple) as validators kwarg for form/model fields. 2016-04-22 09:38:47 +07:00
Matthew Schinckel 5402f3ab09 Fixed #26475 -- Added functools.partial() support to migrations autodetector. 2016-04-19 10:17:11 -04:00
Lukasz Wiecek d3c87a2425 Fixed #26498 -- Fixed TimeField microseconds round-tripping on MySQL and SQLite.
Thanks adamchainz for the report and review.
2016-04-18 09:39:46 -04:00
Tim Graham 0456a8b9e6 Fixed #26486 -- Fixed a select_related() + defer() MTI edge case. 2016-04-13 10:32:17 -04:00
Michal Petrucha c339a5a6f7 Refs #16508 -- Renamed the current "virtual" fields to "private".
The only reason why GenericForeignKey and GenericRelation are stored
separately inside _meta is that they need to be cloned for every model
subclass, but that's not true for any other virtual field. Actually,
it's only true for GenericRelation.
2016-04-13 10:10:53 -04:00
Tim Graham 1c30a6473d Refs #22936 -- Moved IntegerField.get_prep_lookup() logic to lookups. 2016-04-12 10:14:41 -04:00
Claude Paroz f9a2a7db17 Fixed #26351 -- Added MySQL check to warn about strict mode option
Thanks Adam Chainz for the initial implementation in django-mysql.
Thanks Adam Chainz, Tim Graham, and Shai Berger for the reviews.
2016-04-08 20:34:16 +02:00
Claude Paroz 0d3c616fbb Refs #26351 -- Added check hook to support database-related checks
Thanks Tim Graham and Shai Berger for the reviews.
2016-04-08 20:28:00 +02:00
Tim Graham df8d8d4292 Fixed E128 flake8 warnings in django/. 2016-04-08 09:51:06 -04:00
Simon Charette a6074e8908 Fixed #26458 -- Based Avg's default output_field resolution on its source field type.
Thanks Tim for the review and Josh for the input.
2016-04-05 23:48:08 -04:00
Attila Tovt 02ae5fd31a Fixed #25850 -- Made migrate/makemigrations error on inconsistent history. 2016-04-05 08:52:08 -04:00
Tim Graham 6448873197 Fixed E402 flake8 warnings. 2016-04-04 17:14:27 -04:00
Tim Graham 2cd2d18851 Fixed W503 flake8 warnings. 2016-04-04 17:14:26 -04:00
Susan Tan b0803d64c4 Fixed #26075 -- Added clearer wording for one-off values in makemigrations 2016-04-03 17:12:55 +02:00
Markus Holtermann 103d4e1d65 Fixed #26441 -- Added model Field.db_check() method
Thanks Common Code for financing the work on this commit.
2016-04-03 09:56:59 +02:00
Iacopo Spalletti 394755b8d9 Fixed #26443 -- Corrected timezone.now in MigrationQuestioner prompt 2016-04-03 01:33:06 +02:00
Akshesh 49f95cc0a0 Fixed #11560 -- Allowed proxy model multiple-inheritance from the same concrete base model. 2016-03-30 13:06:27 -04:00
Alex Hill 4b2cf1cd27 Fixed #26384 -- Fixed renaming the PK on a model with a self-referential FK on SQLite. 2016-03-29 13:25:09 -04:00
Claude Paroz 03b6947728 Fixed #24932 -- Added Cast database function.
Thanks Ian Foote for the initial patch.
2016-03-29 08:14:33 -04:00
Kai Feldhoff 5336158990 Fixed #25759 -- Added keyword arguments to customize Expressions' as_sql(). 2016-03-29 08:09:58 -04:00
Simon Charette 67cf5efa31 Fixed #26413 -- Fixed a regression with abstract model inheritance and explicit parent links.
Thanks Trac alias trkjgrdg for the report and Tim for investigation and review.
2016-03-28 21:11:37 -04:00
Tim Graham 1c8c0837c6 Sorted single letter imports per the latest version of isort. 2016-03-28 11:45:31 -04:00
Claude Paroz fc01c84bad Avoided need to import model fields in models/functions.py. 2016-03-28 10:59:30 -04:00
Tim Graham fb84e877ce Normalized Func.as_sqlite() signature. 2016-03-28 10:59:12 -04:00
Alexey Kotlyarov a52a531a8b Fixed #26398 -- Made FieldFile.open() respect its mode argument. 2016-03-23 10:05:26 -04:00
Berker Peksag 157d7f1f1d Fixed #25388 -- Added an option to allow disabling of migrations during test database creation 2016-03-23 08:21:30 +08:00
Kai Feldhoff baa8b0ec39 Refs #25759 -- Fixed some Funcs to work if different database backends are used. 2016-03-21 20:20:29 -04:00
Jason Parrott 4c1c93032f Fixed #26373 -- Fixed reverse lookup crash with a ForeignKey to_field in a subquery. 2016-03-19 17:54:29 -04:00
Claude Paroz 983c158da7 Refs #24227 -- Replaced M2M isinstance checks by field.many_to_many
Thanks Markus Holtermann, Collin Anderson and Tim Graham for the reviews.
2016-03-19 09:24:27 +01:00
Andrew Godwin 2b3a941457 Merge pull request #6310 from apollo13/informix
Pass type to sql_alter_column*.
2016-03-18 19:47:15 -03:00
Florian Apolloner 37cde8667e Pass type to sql_alter_column*.
This helps databases which need the database type when changing the default
(Just like MySQL needs it for changing null…)
2016-03-18 23:11:02 +01:00
Tim Graham f15f4b8bb6 Refs #26367 -- Removed obsolete _size cache on FieldField.
The _size attribute is used in File.size but FieldFile overrides it.
2016-03-17 10:25:17 -04:00
Markus Holtermann 1cb65b8a77 Fixed #26157 #25321 -- Added sql/params to extra context of schema logger
Thanks Akshesh Doshi for the initial patch and Tim Graham for the review
2016-03-15 17:45:58 +11:00
Claude Paroz 204e00c0c5 Fixed #26140 -- Suppressed MySQL warning when inserting binary content
Thanks Tim Graham for the review.
2016-03-14 18:08:13 +01:00
Noenglish Professorbut f8d20da047 Fixed a few docstring typos. 2016-03-12 08:45:06 -05:00
Tim Graham 4f0cd0fd16 Fixed #26324 -- Fixed DurationField with fractional seconds on SQLite. 2016-03-10 12:18:29 -05:00
Jarek Glowacki 34c56687ae Fixed #26342 -- Prevented unpacking when repr a NodeNotFoundError 2016-03-10 17:27:35 +11:00