Commit Graph

1021 Commits

Author SHA1 Message Date
Anssi Kääriäinen 8f30556329 Renamed Field.rel attribute to remote_field
Field.rel is now deprecated. Rel objects have now also remote_field
attribute. This means that self == self.remote_field.remote_field.

In addition, made the Rel objects a bit more like Field objects. Still,
marked ManyToManyFields as null=True.
2015-03-25 08:16:12 -04:00
Tim Graham 13bc311cdb Removed getLogger alias in django.utils.log. 2015-03-24 08:41:05 -04:00
Claude Paroz 01ec127bae Fixed #12400 -- Allowed geometry fields in unique_together
Thanks Tim Graham for the review.
2015-03-23 19:52:49 +01:00
Alex Hill 880393a902 Explicitly disable FK constraints in SQLite editor 2015-03-21 10:31:07 +01:00
Alex Hill 6c58e53d5d Safer table alterations under SQLite
Table alterations in SQLite require creating a new table and copying
data over from the old one. This change ensures that no Django model
ever exists with the temporary table name as its db_table attribute.
2015-03-21 10:31:07 +01:00
Jean-Louis Fuchs f4f0060fea Fixed #24447 -- Made migrations add FK constraints for existing columns
When altering from e.g. an IntegerField to a ForeignKey, Django didn't
add a constraint.
2015-03-07 14:09:56 +01:00
Tim Graham 4e8b167e4d Fixed MySQL build failure introduced by refs #24390.
Added table_name back to _create_index_sql() to prevent
duplicate index names on MySQL.
2015-03-02 13:07:34 -05:00
László Károlyi f37c11eea3 Fixed #24390 -- Made migration index names deterministic. 2015-03-02 09:25:19 -05:00
Michael Manfre 7fa7dd48c4 Fixed signature of BaseDatabaseOperations.date_interval_sql() and document the change. 2015-02-22 23:23:16 -05:00
Loic Bistuer bed504d70b Fixed #24351, #24346 -- Changed the signature of allow_migrate().
The new signature enables better support for routing RunPython and
RunSQL operations, especially w.r.t. reusable and third-party apps.

This commit also takes advantage of the deprecation cycle for the old
signature to remove the backward incompatibility introduced in #22583;
RunPython and RunSQL won't call allow_migrate() when when the router
has the old signature.

Thanks Aymeric Augustin and Tim Graham for helping shape up the patch.

Refs 22583.
2015-02-20 21:34:09 +07:00
Marc Tamlyn 32d4db66b9 Update converters to take a consistent set of parameters.
As suggested by Anssi. This has the slightly strange side effect of
passing the expression to Expression.convert_value has the expression
passed back to it, but it allows more complex patterns of expressions.
2015-02-20 11:35:52 +00:00
Shai Berger ceadc94f09 Fixed #24307: Avoided redundant column nullability modifications on Oracle
Thanks Joris Benschop for the report, and Tim Graham for the tests.
2015-02-19 02:39:41 +02:00
Adam Chainz e9282747a4 Removed unused foreign_key_re variables in MySQL/Oracle DB backends 2015-02-18 10:22:30 -05:00
Tim Graham 63c5c98701 Refs #24324 -- Fixed UnicodeEncodeError in SQLite backend while testing.
If 'name' contained non-ASCII characters, the comparison raised a
UnicodeEncodeError on Python 2.
2015-02-17 08:09:46 -05:00
Tim Graham 3adc5f1ee6 Fixed #24335 -- Bumped required psycopg2 version to 2.4.5 (2.5 for contrib.postgres). 2015-02-16 18:07:27 -05:00
Aymeric Augustin a73c8540a8 Removed 'autocommit' options for the psycopg2 backend.
It was documented as not having any effect since Django 1.6.
2015-02-14 18:51:18 +01:00
Aymeric Augustin 28e97a9bdc Cleaned up init_connection_state in the psycopg2 backend.
settings_dict['TIME_ZONE'] is set in ConnectionHandler.ensure_defaults.
2015-02-14 18:51:18 +01:00
Aymeric Augustin 76356d963c Fixed #24318 -- Set the transaction isolation level with psycopg >= 2.4.2. 2015-02-14 18:51:11 +01:00
Josh Smeaton e2d6e14662 Refs #14030 -- Improved expression support for python values 2015-02-12 08:46:25 +11:00
Josh Smeaton 1fbe8a2de3 Fixed #24200 -- Made introspection bypass statement cache 2015-02-10 23:24:34 +02:00
Loic Bistuer c8e24bbc9b Fixed isort import that's inconsistent between platforms. 2015-02-11 02:24:14 +07:00
я котик пур-пур 981bd64dfb Unified local imports in django.db.backends.mysql. 2015-02-09 08:23:17 -05:00
Collin Anderson db77915c9f Fixed E265 comment style 2015-02-06 09:30:35 -05:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Tim Graham 75303b01a9 Fixed #24245 -- Added introspection for database defaults.
Needed for tests for migrations handling of database defaults.
2015-01-31 12:33:11 -05:00
Tim Graham 64a899dc81 Removed PostgreSQL DatabaseWrapper._set_isolation_level().
This method is unused since 8717b0668c.
2015-01-31 11:05:26 -05:00
Tim Graham 29c0073335 Fixed #24164 -- Fixed Oracle GIS limited aggregation test failure. 2015-01-30 06:28:47 -05:00
Tim Graham 18f3e79b13 Removed threading fallback imports.
Django imports threading in many other places without fallback.
2015-01-28 10:23:25 -05:00
Josh Smeaton 8196e4bdf4 Fixed #24154 -- Backends can now check support for expressions 2015-01-27 12:20:06 +11:00
Andriy Sokolovskiy 38c17871bb Fixed #24104 -- Fixed check to look on field.many_to_many instead of class instance 2015-01-22 18:41:19 +01:00
Adam Taylor 039465a6a7 Fixed typos in code comments. 2015-01-20 12:18:03 -05:00
Markus Holtermann 5792e6a88c Fixed #24163 -- Removed unique constraint after index on MySQL
Thanks Łukasz Harasimowicz for the report.
2015-01-19 16:52:26 +01:00
Tim Graham 2b039d966f Removed obsolete SQL generation methods. 2015-01-18 15:58:06 -05:00
Tim Graham 7e8cf74dc7 Removed support for syncing apps without migrations per deprecation timeline.
Kept support for creating models without migrations when running tests
(especially for Django's test suite).
2015-01-18 15:58:06 -05:00
Tim Graham 3b570dbcdb Removed BaseDatabaseValidation.validate_field() per deprecation timeline. 2015-01-17 14:58:09 -05:00
Tim Graham b845951fd4 Required sqlparse for SQL splitting per deprecation timeline. 2015-01-17 10:20:30 -05:00
Tim Graham 4aa089a9a9 Removed support for custom SQL per deprecation timeline. 2015-01-17 10:16:06 -05:00
Tim Graham f6463bb380 Removed the syncdb command per deprecation timeline. 2015-01-17 09:20:12 -05:00
Tim Graham 9ce36512fa Removed backwards compatibility shims for "util" modules per deprecation timeline.
refs #17627.
2015-01-17 07:40:12 -05:00
Marc Tamlyn 39d95fb6ad Fixed #24092 -- Widened base field support for ArrayField.
Several issues resolved here, following from a report that a base_field
of GenericIpAddressField was failing.

We were using get_prep_value instead of get_db_prep_value in ArrayField
which was bypassing any extra modifications to the value being made in
the base field's get_db_prep_value. Changing this broke datetime
support, so the postgres backend has gained the relevant operation
methods to send dates/times/datetimes directly to the db backend instead
of casting them to strings. Similarly, a new database feature has been
added allowing the uuid to be passed directly to the backend, as we do
with timedeltas.

On the other side, psycopg2 expects an Inet() instance for IP address
fields, so we add a value_to_db_ipaddress method to wrap the strings on
postgres. We also have to manually add a database adapter to psycopg2,
as we do not wish to use the built in adapter which would turn
everything into Inet() instances.

Thanks to smclenithan for the report.
2015-01-16 16:15:16 -05:00
Claude Paroz 67bcae1e58 Moved check_aggregate_support to BaseSpatialOperations 2015-01-14 22:03:41 +01:00
Tim Graham 28308078f3 Fixed #22603 -- Reorganized classes in django.db.backends. 2015-01-14 14:16:20 -05:00
Michał Modzelewski 65246de7b1 Fixed #24031 -- Added CASE expressions to the ORM. 2015-01-12 18:15:34 -05:00
Shai Berger aa8ee6a573 Fixed test failures in Oracle introspection
Refs #17785
2015-01-13 01:00:09 +02:00
Josh Smeaton 21b858cb67 Fixed #24060 -- Added OrderBy Expressions 2015-01-13 09:39:55 +11:00
Claude Paroz 4c413e231c Fixed #17785 -- Preferred column names in get_relations introspection
Thanks Thomas Güttler for the report and the initial patch, and
Tim Graham for the review.
2015-01-12 19:58:47 +01:00
Claude Paroz 68a439a18d Removed supports_binary_field flag as all backends support them
It was mainly for MySQL on Python 3, but now the current
recommended MySQL driver for Python 3 (mysqlclient) does support
binary fields, it is unneeded. Refs #20377.
2015-01-11 23:34:47 +01:00
Claude Paroz 7289d01973 Introspected alternate SQLite FK definitions 2015-01-10 16:51:14 +01:00
Anssi Kääriäinen 0c7633178f Fixed #24020 -- Refactored SQL compiler to use expressions
Refactored compiler SELECT, GROUP BY and ORDER BY generation.
While there, also refactored select_related() implementation
(get_cached_row() and get_klass_info() are now gone!).

Made get_db_converters() method work on expressions instead of
internal_type. This allows the backend converters to target
specific expressions if need be.

Added query.context, this can be used to set per-query state.

Also changed the signature of database converters. They now accept
context as an argument.
2015-01-08 14:07:54 -05:00
Daniel Pyrathon fb48eb0581 Fixed #12663 -- Formalized the Model._meta API for retrieving fields.
Thanks to Russell Keith-Magee for mentoring this Google Summer of
Code 2014 project and everyone else who helped with the patch!
2015-01-06 19:25:12 -05:00