Commit Graph

1723 Commits

Author SHA1 Message Date
Aymeric Augustin cb4a000adb [1.6.x] Fixed #21452 -- Non-autocommit connections to PostgreSQL.
When settings.DATABASES['default']['AUTOCOMMIT'] = False, the connection
wasn't in autocommit mode but Django pretended it was.

Thanks Anssi for analysing this issue.

Refs #17062.

Backport of 1afe7488 from master
2014-01-12 18:47:03 +01:00
Loic Bistuer 3bb7de8c7c [1.6.x] Fixed typo and slightly improved error message when db is missing time zone definitions.
Refs #21432.

Backport of 32e75803be from master
2013-12-26 13:07:04 -05:00
Loic Bistuer 67c30426c1 [1.6.x] Fixed #21432 -- DateTimeQuery now copies tzinfo when cloning.
Thanks Enrique Martínez for the report and @bmispelon for the tests.

Backport of 17ed99f3a3 from master.
2013-11-14 21:39:24 +01:00
Loic Bistuer b107421acf [1.6.x] Fixed #21410 -- prefetch_related() for ForeignKeys with related_name='+'
Regression introduced by commit 9777442.

Thanks to trac username troygrosfield for the report and test case.

Backpatch of cb83448891 from master.

Conflicts:

	tests/prefetch_related/models.py
2013-11-13 07:41:30 +02:00
Claude Paroz ec0a3f5085 [1.6.x] Removed relative usage of import_module
Python 3 version of importlib doesn't support this syntax.
Partial backport of fdd7a355bf. Refs #21335.
2013-10-26 23:22:21 +02:00
Anssi Kääriäinen 6781dc6243 [1.6.x] Fixed #21249 -- variable name typo in compiler.get_grouping()
The typo could have consequences in exceptional cases, but I didn't
figure out a way to actually produce such a case, so not tests.

Report & patch by Michael Manfre.

Backport of 86c248aa64 from master
2013-10-21 22:10:42 +03:00
Aymeric Augustin f0c7649b16 Fixed #21198 -- Prevented invalid use of @python_2_unicode_compatible.
Thanks jpic for the report and chmodas for working on a patch.

Reverts 2ea80b94. Refs #19362.

Conflicts:
	tests/utils_tests/test_encoding.py
2013-10-13 18:25:21 +02:00
Aymeric Augustin ddff6522fa [1.6.x] Fixed #19560 -- Identified field in warning for naive datetime.
Thanks gcc for the report and vajrasky for the patch.

Backport of 570d9c2678 from master.
2013-10-13 11:58:12 +02:00
Aymeric Augustin b42f0665a8 [1.6.x] Fixed #21235 -- Disabled savepoints for old versions of SQLite.
Thanks Ramiro for the report.

Backport of 91547772 from master.
2013-10-07 10:49:28 +02:00
Anssi Kääriäinen 9972a101e6 [1.6.x] Fixed #21203 -- resolve_columns fields misalignment
In queries using .defer() together with .select_related() the values
and fields arguments didn't align properly for resolve_columns().

Backpatch of bf13c75c0d from master.
2013-10-01 20:47:28 +03:00
Aymeric Augustin 0d74bdaf0c Fixed #21134 -- Prevented queries in broken transactions.
Backport of 728548e4 from master.

Squashed commit of the following:

commit 63ddb271a44df389b2c302e421fc17b7f0529755
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Sep 29 22:51:00 2013 +0200

    Clarified interactions between atomic and exceptions.

commit 2899ec299228217c876ba3aa4024e523a41c8504
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Sep 22 22:45:32 2013 +0200

    Fixed TransactionManagementError in tests.

    Previous commit introduced an additional check to prevent running
    queries in transactions that will be rolled back, which triggered a few
    failures in the tests. In practice using transaction.atomic instead of
    the low-level savepoint APIs was enough to fix the problems.

commit 4a639b059ea80aeb78f7f160a7d4b9f609b9c238
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Sep 24 22:24:17 2013 +0200

    Allowed nesting constraint_checks_disabled inside atomic.

    Since MySQL handles transactions loosely, this isn't a problem.

commit 2a4ab1cb6e83391ff7e25d08479e230ca564bfef
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Sep 21 18:43:12 2013 +0200

    Prevented running queries in transactions that will be rolled back.

    This avoids a counter-intuitive behavior in an edge case on databases
    with non-atomic transaction semantics.

    It prevents using savepoint_rollback() inside an atomic block without
    calling set_rollback(False) first, which is backwards-incompatible in
    tests.

    Refs #21134.

commit 8e3db393853c7ac64a445b66e57f3620a3fde7b0
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Sep 22 22:14:17 2013 +0200

    Replaced manual savepoints by atomic blocks.

    This ensures the rollback flag is handled consistently in internal APIs.
2013-09-30 10:14:22 +02:00
Anssi Kääriäinen d7ae0bc372 [1.6.x] Fixed #21126 -- QuerySet value conversion failure
A .annotate().select_related() query resulted in misaligned rows vs
columns for compiler.resolve_columns() method.

Report & patch by Michael Manfre.

Backpatch of 83554b018e from master.
2013-09-25 20:50:48 +03:00
Anssi Kääriäinen 1a922870ea [1.6.x] Fixed #21150 -- Improved Query.add_fields() join promotion logic
Thanks to Eivind Fonn for the report and test case.
2013-09-24 19:04:42 +03:00
Anssi Kääriäinen 5937f291c1 [1.6.x] Fixed #21109 -- made db cursor error wrapping faster
Backpatch of 9400142132 from master.
2013-09-17 12:31:13 +03:00
Садовский Николай e4274e3da1 [1.6.x] Fixed #20707 -- Added explicit quota assignment to Oracle test user
To enable testing on Oracle 12c
2013-09-09 14:02:21 +03:00
Aymeric Augustin f855058c35 [1.6.x] Fixed #11811 -- Data-loss bug in queryset.update.
It's now forbidden to call queryset.update(field=instance) when instance
hasn't been saved to the database ie. instance.pk is None.

Conflicts:
	tests/queries/tests.py

Backport of b4cd8169 from master.
2013-09-06 21:59:28 -05:00
Eric Boersma 180b9955cc [1.6.x] Fixed #21035 -- Changed docs to treat the acronym SQL phonetically.
The documentation and comments now all use 'an' to
refer to the word SQL and not 'a'.

Backport of 4d13cc56de from master
2013-09-05 20:16:14 -04:00
Aymeric Augustin a8624b22a7 [1.6.x] Tested exc_type instead of exc_value in __exit__.
exc_value might be None even though there's an exception, at least on
Python 2.6. Thanks Thomas Chaumeny for the report.

Fixed #21034.
2013-09-04 16:18:47 -05:00
Aymeric Augustin 2a14c08e71 Used six.moves.zip_longest, new in six 1.4.0. 2013-09-03 07:34:45 -05:00
Aymeric Augustin 115318051c [1.6.x] Replaced "not PY3" by "PY2", new in six 1.4.0.
Conflicts:
	django/db/backends/oracle/base.py
	django/db/backends/sqlite3/base.py
	django/db/models/base.py

Backport of 365c3e8b from master.
2013-09-03 07:34:45 -05:00
Carl Meyer 21a3efcf48 [1.6.x] Fixed #20999 - Allow overriding formfield class with choices, without subclass restrictions.
Refs #18162. Thanks claudep and mjtamlyn for review.

Backport of 7211741fc5 from master.
2013-08-30 17:45:14 -06:00
Anssi Kääriäinen 76e38a2177 [1.6.x] Fixed #20988 -- Added model meta option select_on_save
The option can be used to force pre 1.6 style SELECT on save behaviour.
This is needed in case the database returns zero updated rows even if
there is a matching row in the DB. One such case is PostgreSQL update
trigger that returns NULL.

Reviewed by Tim Graham.

Refs #16649

Backport of e973ee6a98 from master

Conflicts:
	django/db/models/options.py
	tests/basic/tests.py
2013-08-30 09:47:34 +03:00
Anssi Kääriäinen cd10e998b6 [1.6.x] Removed stale add_q() comment
Backport of 13be3bfef1 from master
2013-08-30 09:46:16 +03:00
Tim Graham 10d15f79e5 [1.6.x] Fixed #14786 -- Fixed get_db_prep_lookup calling get_prep_value twice if prepared is False.
Thanks homm for the report and Aramgutang and lrekucki for work on
the patch.

Backport of f19a3669b8 from master
2013-08-29 12:14:40 -04:00
Claude Paroz 58157be5ad [1.6.x] Fixed #20984 -- Stopped decoding bytes in sqlite3 adapter on Python 3
Thanks lvella at gmail.com for the report.
Backport of 169637649 from master.
2013-08-29 08:43:35 +02:00
Anssi Kääriäinen 161e26c2ec [1.6.x] Fixed #20955 -- select_related regression
In cases where the same connection (from model A to model B along the
same field) was needed multiple times in a select_related query, the
join setup code mistakenly reused an existing join.

Backpatch of 8d65b6082c.

Conflicts:

	django/db/models/sql/compiler.py
	tests/queries/tests.py
2013-08-22 10:59:59 +03:00
Anssi Kääriäinen 2b1101a4a6 [1.6.x] Fixed #20820 -- Model inheritance + m2m fixture loading regression
Tests by Tim Graham, report from jeroen.pulles@redslider.net.

Backport of 1ed77e7782 from master
2013-08-20 17:15:52 +03:00
Simon Charette f0bc2865ff Fixed #20943 -- Weakly reference senders when caching their associated receivers
Backport of e55ca60903 from master.
2013-08-20 02:12:50 -04:00
Harm Geerts a6ac4f90d0 [1.6.x] Fixed #20829 -- Skip postgis metadata tables with introspection
Backport of 24088618 from master.
2013-08-16 21:21:41 +02:00
Alex Cucu 80b95a2b1f [1.6.x] Fixed #19918 -- Modified select_for_update to run on the write database.
Backport of 1c64a0f29e from master
2013-08-06 10:58:32 -04:00
Tim Graham 196cc875b2 [1.6.x] Fixed #17519 -- Fixed missing SQL constraints to proxy models.
Thanks thibaultj for the report, jenh for the patch,
and charettes for the tests.

Backport of aa830009de from master
2013-08-02 08:42:19 -04:00
Tim Graham b3e54f4a01 [1.6.x] Removed unused model option "admin"
Backport of 5df84b268d from master
2013-08-01 12:33:19 -04:00
Shai Berger 17e632929c [1.6.x] Fixed #20785 -- Corrected exception caught for Oracle LIKE operator detection
The code that tests to see which LIKE expressions to use now runs
using non-error-wrapped cursor, so cx_Oracle exceptions need to be caught
rather than Django DatabaseErrors.

Thanks Trac user ludo for report and initial patch.
2013-07-30 03:32:02 +03:00
Anssi Kääriäinen 7f892cedba [1.6.x] Fixed related model lookup regression
It has been possible to use models of wrong type in related field
lookups. For example pigs__in=[a_duck] has worked. Changes to
ForeignObject broke that.

It might be a good idea to restrict the model types usable in lookups.
This should be done intentionally, not accidentally and without any
consideration for deprecation path.

Backpatch of 7cca8d56d2 from master.
2013-07-26 13:17:50 +03:00
Anssi Kääriäinen d439f85bbf [1.6.x] Fixed ._meta.pk_index() virtual field failure
Backport of 92476e880c from master
2013-07-25 16:35:04 +03:00
ersran9 7295a8262f [1.6.x] Fixed #20791 -- Reworded ForeignKey default error message
Backport of 311c1d2848 from master.
2013-07-23 22:19:02 +02:00
Anssi Kääriäinen 43f1d51b4b [1.6.x] Minor change to get_extra_descriptor_filter()
Refs #20611. Backpatch of 6b4967e883.
2013-07-23 15:37:26 +03:00
Tim Graham 7f210563ab [1.6.x] Fixed backport of #20740 2013-07-12 18:00:09 -04:00
Tim Graham 45fab74561 [1.6.x] Fixed #20740 -- GenericIPAddressField should pass protocol to formfield()
Thanks Jeff250.

Backport of f2cb94f1c0 from master
2013-07-12 16:06:43 -04:00
Shai Berger ae685e54cb [1.6.x] Fixed last_executed_query test failure on Oracle
Backport of c0a4894dca from master.
2013-07-09 19:52:16 +02:00
Aymeric Augustin 02976a46c9 [1.6.x] Introduced getters for connection.autocommit and .needs_rollback.
They ensure that the attributes aren't accessed in conditions where they
don't contain a valid value.

Fixed #20666.

Backport of dd9c6bc359 from master.
2013-06-30 16:29:57 +02:00
Claude Paroz 59be2c6875 [1.6.x] Fixed #18592 -- Prevented crash when accessing MySQL _last_executed
Thanks reames at asymmetricventures.com for the report.
Backport of 59b0c48ce from master.
2013-06-29 18:48:05 +02:00
Claude Paroz b6aed803b2 [1.6.x] Fixed #20660 -- Do not try to delete an unset FieldFile
Thanks stanislas.guerra at gmail.com for the report and
Baptiste Mispelon for the review.
Backport of ea3fe78a9d from master.
2013-06-29 18:11:51 +02:00
Shai Berger d097417025 Support 'pyformat' style parameters in raw queries, Refs #10070
Add support for Oracle, fix an issue with the repr of RawQuerySet,
add tests and documentations. Also added a 'supports_paramstyle_pyformat'
database feature, True by default, False for SQLite.

Thanks Donald Stufft for review of documentation.
2013-06-28 06:59:10 +03:00
Aymeric Augustin c1284c3d3c Fixed #20571 -- Added an API to control connection.needs_rollback.
This is useful:
- to force a rollback on the exit of an atomic block without having to
  raise and catch an exception;
- to prevent a rollback after handling an exception manually.
2013-06-27 22:19:54 +02:00
Andrew Godwin 99b467f272 Add related_query_name to ForeignKey/M2M. Refs #20244 2013-06-27 14:44:21 +01:00
Loic Bistuer a9ea7d8c70 Fixed #20462 - Replaced the str() cast introduced in 273dc55 by force_text() 2013-06-26 21:30:58 +07:00
Andrew Clark 273dc550a4 Fixed #20462 -- null/non-string regex lookups are now consistent
Thanks to noirbizarre for the report and initial patch.
2013-06-26 08:13:26 -04:00
Simon Charette b91787910c Fixed #20642 -- Deprecated `Option.get_(add|change|delete)_permission`.
Those methods were only used by `contrib.admin` internally and exclusively
related to `contrib.auth`. Since they were undocumented but used
in the wild the raised deprecation warning point to an also undocumented
alternative that lives in `contrib.auth`.

Also did some PEP8 and other cleanups in the affected modules.
2013-06-25 12:22:37 -04:00
Gilberto Gonçalves 680b512fc1 Fixed #20587 -- Made convert_values handle None values 2013-06-22 14:05:12 +01:00