Commit Graph

3118 Commits

Author SHA1 Message Date
Simon Charette 4a9c32f5ee Refs #25693 -- Avoided redundant calls to get_fields() in `to_attr` validation. 2015-11-11 12:25:10 -05:00
Simon Charette 4cd5d846d4 Fixed #25730 -- Made Model.__str__() always return str instances.
Thanks to Kevin Turner for the report and Tim for the review.
2015-11-11 12:18:52 -05:00
Ian Foote 4608573788 Fixed #25693 -- Prevented data loss with Prefetch and ManyToManyField.
Thanks to Jamie Matthews for finding and explaining the bug.
2015-11-10 12:12:07 -05:00
Laura Feier 7862cbda86 Fixed #24576 -- Made deletion of related objects deterministic. 2015-11-09 15:04:48 -05:00
Dmitry Dygalo 917100eed7 Simplified dict initialization in two places. 2015-11-07 21:46:46 +01:00
Sergey Fedoseev 0a26121797 Refs #25629 -- Added `arity` class attribute to `Func` expressions 2015-11-02 20:09:21 +01:00
Tim Graham c4af8eb366 Refs #25618 -- Removed detection of south migrations in loader.
It doesn't seem relevant for anyone upgrading to Django 1.10
and beyond.
2015-10-28 09:16:22 -04:00
Ian Foote 32ef48aa56 Fixed #25609 -- Fixed regression in related field nested lookup error. 2015-10-27 13:49:00 -04:00
Simon Charette 976bd519a8 Revert "Fixed #25417 -- Added a field check for invalid default values."
This reverts commit 71ebcb85b9.
2015-10-27 11:02:35 -04:00
Tim Graham 9c5e272860 Fixed #25550 -- Deprecated direct assignment to the reverse side of a related set. 2015-10-27 07:57:15 -04:00
Tim Graham 0b5d32faca Fixed #25611 -- Standardized descriptor signatures. 2015-10-26 11:31:16 -04:00
Mariusz Felisiak 0f6d51e6a0 Fixed #25470 -- Avoided unnecessary, expensive DATETIME typecast on MySQL. 2015-10-21 19:24:19 -04:00
Simon Charette 2ee67f0373 Moved an inner function in db.migrations.state to avoid redefinition. 2015-10-19 20:15:13 -04:00
Simon Charette 63f0e2df2a Refs #18012 -- Accounted for reverse proxy relations in migrations.
Thanks to Markus for the suggestion and Tim for the review.
2015-10-19 20:15:13 -04:00
Simon Charette 3db3ab71e9 Fixed #25563 -- Cached deferred models in their proxied model's _meta.apps.
Thanks to Andriy Sokolovskiy for the report and Tim Graham for the review.
2015-10-19 20:11:32 -04:00
Josh Smeaton 6c95b134e9 Fixed #25517 -- Made Concat function idempotent on SQLite. 2015-10-17 15:51:04 -04:00
Simon Charette c1b6a8a98b Fixed #25560 -- Made empty string related_name invalid.
Thanks to Ali Lotfi for the initial report and patch
and Tim Graham for the review.
2015-10-16 14:22:15 -04:00
Antoine Catton b971c1cd78 Fixed #25506 -- Allowed filtering over a RawSQL annotation.
Co-Authored-By: Gavin Wahl <gwahl@fusionbox.com>
2015-10-14 11:13:58 -07:00
Tim Graham c7aff31397 Refs #25535 -- Minor edits to ForeignObject check changes. 2015-10-14 05:21:08 -07:00
Antoine Catton 80dac8c33e Fixed #25535 -- Made ForeignObject checks less strict.
Check that the foreign object `from_fields` are a subset of any unique
constraints on the foreign model.
2015-10-12 18:00:59 -04:00
Simon Charette a82e21b0f9 Refs #18012 -- Removed the now unused proxied_children model option.
Thanks to Tim for the review.
2015-10-12 12:14:27 -04:00
Simon Charette 5b980897f2 Refs #18012 -- Made proxy and concrete model reverse fields consistent.
Prior to this change proxy models reverse fields didn't include the
reverse fields pointing to their concrete model.
2015-10-12 12:14:27 -04:00
Simon Charette 211486f3ab Fixed #23076, #25505 -- Fixed deletion of intermediate proxy models.
Thanks to James Murty for his work on an alternate patch.
2015-10-12 12:14:26 -04:00
Simon Charette 8bdfabed65 Refs #18012 -- Removed special casing for proxy models deletion.
This isn't required anymore now that reverse foreign keys
from proxy models are propagated to their concrete model.
2015-10-12 12:14:26 -04:00
Simon Charette 6c9f37ea9e Fixed #18012 -- Propagated reverse foreign keys from proxy to concrete models.
Thanks to Anssi for the review.
2015-10-12 12:14:26 -04:00
Tim Graham 67732a9b18 Fixed #24687 -- Added select_related() validation for nested non-relational fields.
The removed test was added in the original select_related() validation
patch (45d4e43d2d), but there doesn't
seem to be any reason for it.

Thanks Claude Paroz for help and review.
2015-10-10 09:48:50 -04:00
Tim Graham 7a5b7e35bf Fixed #22705 -- Fixed QuerySet.bulk_create() on models without any fields on Oracle.
Fixed on other backends by 134ca4d438.

Thanks Mariusz Felisiak for the solution.
2015-10-09 14:16:06 -04:00
Tim Graham 384ddbec1b Fixed #14368 -- Allowed setting a reverse OneToOne relation to None. 2015-10-09 10:20:53 -04:00
Mariusz Felisiak 914167abf1 Fixed #25503 -- Fixed system check crash on ForeignKey to abstract model. 2015-10-06 19:22:37 -04:00
Tim Graham e0837f2cb1 Fixed #25508 -- Modified QuerySet.__repr__() to disambiguate it from a list. 2015-10-06 12:38:34 -04:00
Riccardo Magliocchetti 3543fec3b7 Refs #12118 -- Allowed "mode=memory" in SQLite test database names. 2015-10-06 12:32:05 -04:00
Tim Graham ea8e7fd989 Removed obsolete (since Python 2.3) __safe_for_unpickling__ attribute. 2015-10-05 08:07:27 -04:00
Tim Graham 9f6b704769 Fixed #21042 -- Allowed accessing FileDescriptor on the model class.
This is consistent with ability to reference other descriptors
on the model class (5ef0c03ae9).
2015-10-01 15:19:39 -04:00
Mariusz Felisiak a3a6def867 Fixed #25421 -- Fixed test --keepdb option on Oracle. 2015-09-26 19:51:15 -04:00
Ville Skyttä afe777639c Fixed #25196 -- Normalized database representations in test database messages.
Left over Oracle mostly as-is since it's more complicated.
2015-09-25 10:21:55 -04:00
Tim Graham 1f84721fac Removed unused Aggregate.input_field.
Obsolete since 4a66a69239.
2015-09-24 09:15:56 -04:00
Tim Graham a780505f3a Refs #14030 -- Removed more backwards compatiblity for old-style aggregates.
Per deprecation timeline.
2015-09-24 09:15:55 -04:00
Tim Graham 96317ad8de Refs #21414 -- Removed Field.related per deprecation timeline. 2015-09-23 19:31:10 -04:00
Tim Graham fd6a299cd0 Refs #14030 -- Removed backwards compatiblity for old-style aggregates.
Per deprecation timeline.
2015-09-23 19:31:10 -04:00
Tim Graham 1bb6ecf6d3 Refs #9893 -- Removed shims for lack of max_length support in file storage per deprecation timeline. 2015-09-23 19:31:10 -04:00
Tim Graham 3f50dc2be5 Removed SQLCompiler.__call__() per deprecation timeline. 2015-09-23 19:31:09 -04:00
Tim Graham c64dd646f5 Refs #12663 -- Removed deprecated Model._meta methods. 2015-09-23 19:31:09 -04:00
Tim Graham 08ab262649 Removed SubfieldBase per deprecation timeline. 2015-09-23 19:31:09 -04:00
Tim Graham 4fd264b6f1 Refs #24351 -- Removed support for the old allow_migrate() signature per deprecation timeline. 2015-09-23 19:31:09 -04:00
Benjamin Wohlwend de31423130 Fixed #25453 -- Reworded makemigration's ask_not_null_alteration suggestion. 2015-09-23 13:33:41 -04:00
Alex Hill 134ca4d438 Fixed #24509 -- Added Expression support to SQLInsertCompiler 2015-09-22 23:35:24 +10:00
Aymeric Augustin 91e9f1c972 Fixed #24921 -- set_autocommit(False) + ORM queries.
This commits lifts the restriction that the outermost atomic block must
be declared with savepoint=False. This restriction was overly cautious.

The logic that makes it safe not to create savepoints for inner blocks
also applies to the outermost block when autocommit is disabled and a
transaction is already active.

This makes it possible to use the ORM after set_autocommit(False).
Previously it didn't work because ORM write operations are protected
with atomic(savepoint=False).
2015-09-21 22:21:53 +02:00
Aymeric Augustin 361254810e Documented "rel objects".
Kept the docstring short because these objects aren't very well defined
and they're in the crosshairs of several refactorings.
2015-09-21 22:20:42 +02:00
Aymeric Augustin e542e81b39 Renamed descriptor classes for related objects.
The old names were downright confusing. Some seemed to mean the opposite
of what the class actually did.

The new names follow a consistent nomenclature:

    (Forward|Reverse)(ManyToOne|OneToOne|ManyToMany)Descriptor.

I mentioned combinations that do not exist in the docstring in order to
help people who would search for them in the code base.
2015-09-21 22:20:42 +02:00
Aymeric Augustin 2409a4241a Added comments in related instances descriptors. 2015-09-21 22:06:04 +02:00
Aymeric Augustin 497d915299 Documented related models descriptors.
Changed the poll / choices example to a more obvious parent / children.
I think that reduces the cognitive load.
2015-09-21 22:06:03 +02:00
Aymeric Augustin 005c9fc45f Fixed #22341 -- Split django.db.models.fields.related.
At 2800 lines it was the largest module in the django package. This
commit brings it down to a more manageable 1620 lines.

Very small changes were performed to uniformize import style.
2015-09-21 22:05:30 +02:00
Josh Smeaton 534aaf56f4 Fixed #24629 -- Unified Transform and Expression APIs 2015-09-21 19:56:24 +10:00
Raphael Merx f5a33e4840 Fixed #25296 -- Prevented model related object cache pollution when create() fails due to an unsaved object. 2015-09-19 20:49:13 -04:00
Aymeric Augustin c3904deb91 Fixed #25160 (again) -- Moved data loss check on reverse relations.
Moved data loss check when assigning to a reverse one-to-one relation on
an unsaved instance to Model.save(). This is exactly the same change as
e4b813c but for reverse relations.
2015-09-19 20:27:53 +02:00
Markus Holtermann 5aa55038ca Fixed #24743, #24745 -- Optimized migration plan handling
The change partly goes back to the old behavior for forwards migrations
which should reduce the amount of memory consumption (#24745). However,
by the way the current state computation is done (there is no
`state_backwards` on a migration class) this change cannot be applied to
backwards migrations. Hence rolling back migrations still requires the
precomputation and storage of the intermediate migration states.

This improvement also implies that Django does not handle mixed
migration plans anymore. Mixed plans consist of a list of migrations
where some are being applied and others are being unapplied.

Thanks Andrew Godwin, Josh Smeaton and Tim Graham for the review as well
as everybody involved on the ticket that kept me looking into the issue.
2015-09-19 14:54:53 +10:00
Simon Charette 71ebcb85b9 Fixed #25417 -- Added a field check for invalid default values. 2015-09-18 14:31:36 -04:00
Iulia Chiriac 75ed590032 Fixed #24636 -- Added model field validation for decimal places and max digits. 2015-09-18 14:30:20 -04:00
Hynek Cernoch 4b9d063da0 Refs #17785 -- Made docstring for sqlite3's get_relations() consistent with other backends. 2015-09-18 09:32:36 -04:00
Aymeric Augustin 4f6a7663bc Refs #14091 -- Fixed connection.queries on SQLite. 2015-09-17 23:01:33 +02:00
Simon Charette 4d886db078 Removed the unused JoinPromoter.outer_votes attribute. 2015-09-17 13:47:06 -04:00
Tim Graham 7506616f16 Refs #24215 -- Fixed Python 3.5 compatiblity for unhandled lazy ops error. 2015-09-17 10:06:52 -04:00
Adam Chainz 3fe3887a2e Fixed #25377 -- Changed Count queries to execute COUNT(*) instead of COUNT('*'). 2015-09-14 13:41:35 -04:00
Ville Skyttä 4d933ad418 Fixed #25393 -- Fixed MySQL crash when adding text/blob field with unhashable default. 2015-09-14 12:25:08 -04:00
Dražen Odobašić b1e33ceced Fixed #23395 -- Limited line lengths to 119 characters. 2015-09-12 11:40:50 -04:00
Markus Holtermann f45ee19746 Refs #24919 -- Raised more helpful error message for disabled migrations 2015-09-12 10:38:15 +10:00
Markus Holtermann a3c01b0dd8 Fixed #24919 -- Allowed disabling of migrations on a per app basis 2015-09-12 10:38:15 +10:00
Adam Chainz b2f6e421a3 Fixed #25329 -- Prevented _nodb_connection from being left open 2015-09-11 08:40:43 +02:00
Aymeric Augustin 33c7c2a557 Enabled parallel testing by default in runtests.py. 2015-09-10 13:34:05 +02:00
Aymeric Augustin 05cea7fdbb Changed database connection duplication technique.
This new technique is more straightforward and compatible with test
parallelization, where the effective database connection settings no
longer match settings.DATABASES.
2015-09-09 23:03:51 +02:00
Aymeric Augustin 0586c061f0 Cloned databases for running tests in parallel. 2015-09-09 23:01:15 +02:00
Alex Hill 25c157e4cc Refs #24215 -- Improved error message for unhandled lazy model operations. 2015-09-07 20:31:58 -04:00
Nick Pope 1743efbe62 Fixed typos in django/db/models/query.py docstrings. 2015-09-07 15:47:02 -04:00
Aymeric Augustin 6d1110f2f0 Updated references to the TEST_* database settings.
They were removed in Django 1.9.

I could leave the reference to TEST_DEPENDENCIES in the 1.2.4 release
notes because the link points to the right location and the name was
accurate at the time.
2015-09-05 19:21:22 +02:00
Tim Graham 2dc9ec5616 Fixed #24525 -- Fixed AssertionError in some complex queries.
Thanks Anssi Kääriäinen for providing the solution.
2015-09-05 07:51:17 -04:00
Tim Graham 233b46f931 Fixed #19263 -- Fixed crash when filtering using __in and an empty QuerySet.
Thanks Marcin Biernat for the initial patch and tests.
2015-09-04 07:44:36 -04:00
sarthakmeh 40bf18e702 Fixed #25058 -- Added GenericRelations with related_query_name to the admin's delete confirmation page. 2015-09-03 10:08:51 -04:00
Gavin Wahl 627c7eb7bf Fixed #25335 -- Fixed regression where QuerySet.iterator() didn't return an iterator. 2015-09-03 07:35:22 -04:00
Tim Graham 0e925de245 Removed obsolete TODO about moving CommaSeparatedIntegerField into contrib. 2015-09-01 09:13:20 -04:00
Tim Graham 064d4b1cb0 Fixed #25320 -- Reverted ManyToManyField.null to False for backwards compatibility.
Thanks Tom Christie for the report and review.
2015-09-01 07:59:39 -04:00
Maxime Lorant 5153a3bfdc Fixed #25331 -- Removed trailing blank lines in docstrings. 2015-08-31 17:37:21 -04:00
Tyson Clugg e34226fc37 Fixed #25259 -- Added comments to header of generated migration files 2015-08-31 22:14:21 +10:00
Y3K cbcf78fa94 Fixed #25252 -- Added friendly error message on incorrect .select_related() use
Using select_related() after .values() or .values_list() is not possible
because .values() or .values_list() already got the values they need.
2015-08-31 15:13:59 +10:00
Alex Hill 7bec480fe2 Fixed #24201 -- Added order_with_respect_to support to GenericForeignKey. 2015-08-27 09:20:17 -04:00
Markus Holtermann e1427cc609 Fixed #24590 -- Cached calls to swappable_setting.
Moved the lookup in Field.swappable_setting to Apps, and added
an lru_cache to cache the results.

Refs #24743

Thanks Marten Kenbeek for the initial work on the patch. Thanks Aymeric
Augustin and Tim Graham for the review.
2015-08-27 17:06:21 +10:00
Markus Holtermann 91f701f4fc Fixed #25280 -- Properly checked regex objects for equality to prevent infinite migrations
Thanks Sayid Munawar and Tim Graham for the report, investigation and
review.
2015-08-27 09:52:53 +10:00
Jeremy Satterfield 1175027641 Fixed #25308 -- Made MigrationQuestioner respect MIGRATION_MODULES setting. 2015-08-26 09:04:00 -04:00
sarthakmeh 4bc00defd0 Fixed #14217 -- Added validation for field name collision when using model inheritance. 2015-08-25 16:16:54 -04:00
Tim Graham 333cbdcd2d Fixed #24951 -- Fixed AssertionError in delete queries involving a foreign/primary key.
Thanks Anssi Kääriäinen for help.
2015-08-20 08:14:16 -04:00
Caio Ariede dad8434d6f Fixed #25180 -- Prevented varchar_patterns_ops and text_patterns_ops indexes for ArrayField. 2015-08-15 10:02:08 -04:00
Valentina Mukhamedzhanova 1f7b25c1a7 Fixed #24986 -- Added support for annotations in DISTINCT queries. 2015-08-15 08:23:32 -04:00
Alex Hill 98bcdfa8bd Fixed #25064 -- Allowed empty join columns. 2015-08-15 07:26:44 -04:00
Valentina Mukhamedzhanova 6bd7ee4eab Made Options.get_base_chain() always return a list. 2015-08-14 13:15:31 -04:00
Caio Ariede de41fbb3cf Fixed #25239 -- Corrected makemigrations numbering if a migration has a number-only filename. 2015-08-14 07:28:37 -04:00
Ion Scerbatiuc 0cc059cd10 Fixed #25172 -- Fixed check framework to work with multiple databases. 2015-08-12 18:00:26 -04:00
Tim Graham 5980b05c1f Fixed #25160 -- Moved unsaved model instance data loss check to Model.save()
This mostly reverts 5643a3b51b and
81e1a35c36.

Thanks Carl Meyer for review.
2015-08-10 08:51:32 -04:00
Caio Ariede bcb4fe0012 Refs #25175 -- Added backwards compatibility for importing postgresql_psycopg2 backend. 2015-08-07 09:34:18 -04:00
Caio Ariede ec9004728e Fixed #25175 -- Renamed the postgresql_psycopg2 database backend to postgresql. 2015-08-07 09:33:17 -04:00
Tim Graham 770449e24b Removed unused Field.get_flatchoices() method.
Unused since c2ba59fc1d (Django 1.0).

Thanks Andy Baker for the report.
2015-08-03 13:08:24 -04:00
Piper Merriam 537818af87 Fixed #25185 -- Added support for functools.partial serialization in migrations 2015-07-29 10:15:50 -04:00