Andrew Godwin
32838a5beb
Make db.migrations ignore South-style migrations.
2013-09-06 10:35:53 -05:00
Loic Bistuer
e1266e50b2
Fixed #21015 -- Fixed MigrationLoader when importlib.import_module returns a file module or an empty directory.
2013-09-06 08:30:19 -04:00
Loic Bistuer
82bbb9fe81
Fixed #21014 -- Fixed gobbled ImportError in MigrationLoader.
2013-09-06 08:30:18 -04:00
Eric Boersma
4d13cc56de
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'.
2013-09-05 20:14:58 -04:00
Aymeric Augustin
4170b9f402
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 .
Forward-port of a8624b2
from 1.6.x.
2013-09-04 16:19:04 -05:00
Loic Bistuer
34d52fd32e
Fixed #21010 -- Changed ModelState to only copy _meta.local_fields.
2013-09-04 14:05:59 -04:00
Aymeric Augustin
868b4c921c
Used six.moves.zip_longest, new in six 1.4.0.
2013-09-02 12:11:16 +02:00
Aymeric Augustin
365c3e8b73
Replaced "not PY3" by "PY2", new in six 1.4.0.
2013-09-02 12:11:02 +02:00
Loic Bistuer
ff9e116198
Fixed #21008 -- Made MigrationWriter handle Promise objects.
2013-08-31 20:26:44 -04:00
Carl Meyer
7211741fc5
Fixed #20999 - Allow overriding formfield class with choices, without subclass restrictions.
...
Refs #18162 . Thanks claudep and mjtamlyn for review.
2013-08-30 17:43:10 -06:00
Simon Charette
11cd7388f7
Fixed #20989 -- Removed useless explicit list comprehensions.
2013-08-30 10:57:51 -04:00
Anssi Kääriäinen
e973ee6a98
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
2013-08-30 09:41:07 +03:00
Anssi Kääriäinen
13be3bfef1
Removed stale add_q() comment
2013-08-30 09:45:32 +03:00
Tim Graham
c7d0ff0cad
Fixed #20989 -- Removed explicit list comprehension inside dict() and tuple()
...
Thanks jeroen.pulles at redslider.net for the suggestion and
helper script.
2013-08-29 12:11:03 -04:00
Tim Graham
f19a3669b8
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.
2013-08-29 11:13:34 -04:00
Claude Paroz
169637649b
Fixed #20984 -- Stopped decoding bytes in sqlite3 adapter on Python 3
...
Thanks lvella at gmail.com for the report.
2013-08-29 08:39:06 +02:00
Andrew Godwin
35230adf63
Python 3 compat fix for callable()
2013-08-23 17:59:35 +01:00
Andrew Godwin
2787de652a
Fix location of tablespace clauses in schema backend column SQL
2013-08-23 14:38:55 +01:00
Andrew Godwin
5569b0b92f
Merge remote-tracking branch 'core/master' into schema-alteration
...
Conflicts:
django/db/backends/oracle/base.py
django/db/backends/postgresql_psycopg2/base.py
django/db/models/signals.py
tests/queries/tests.py
2013-08-23 12:36:53 +01:00
Andrew Godwin
9cc6cfc405
Fix Oracle's default handling and schema-prepared-statement issue
2013-08-23 12:07:55 +01:00
Anssi Kääriäinen
6af05e7a0f
Fixed model.__eq__ and __hash__ for no pk value cases
...
The __eq__ method now considers two instances without primary key value
equal only when they have same id(). The __hash__ method raises
TypeError for no primary key case.
Fixed #18864 , fixed #18250
Thanks to Tim Graham for docs review.
2013-08-22 17:24:07 +03:00
Tim Graham
768bbf3efe
Revert "Fixed #20956 -- Removed useless check in django.db.utils"
...
This reverts commit ce0e86cf76
.
The check is necessary if 'ENGINE' is an empty string.
Thanks apollo13 for pointing this out.
2013-08-22 09:47:17 -04:00
Dima Kurguzov
ce0e86cf76
Fixed #20956 -- Removed useless check in django.db.utils
2013-08-22 08:53:14 -04:00
Anssi Kääriäinen
8d65b6082c
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.
2013-08-22 10:51:07 +03:00
Tim Graham
3f416f6379
Fixed a regression with get_or_create and virtual fields.
...
refs #20429
Thanks Simon Charette for the report and review.
2013-08-21 22:32:04 +01:00
Anssi Kääriäinen
244e2b71f5
Fixed #20946 -- model inheritance + m2m failure
...
Cleaned up the internal implementation of m2m fields by removing
related.py _get_fk_val(). The _get_fk_val() was doing the wrong thing
if asked for the foreign key value on foreign key to parent model's
primary key when child model had different primary key field.
2013-08-21 22:32:04 +01:00
Simon Charette
1db5fce1ee
Oracle also treats NULLs as largests values when ordering.
2013-08-21 22:32:03 +01:00
Anssi Kääriäinen
f5552571dc
Fixed #20820 -- Model inheritance + m2m fixture loading regression
...
Tests by Tim Graham, report from jeroen.pulles@redslider.net .
2013-08-21 22:31:50 +01:00
Anssi Kääriäinen
ced3e6b17d
Fixed test failure caused by different NULL ordering between backends
2013-08-21 22:31:50 +01:00
Anssi Kääriäinen
cea7204504
Fixed #14056 -- Made sure LEFT JOIN aren't trimmed in ORDER BY
...
If LEFT JOINs are required for correct results, then trimming the join
can lead to incorrect results. Consider case:
TBL A: ID | TBL B: ID A_ID
1 1 1
2
Now A.order_by('b__a') did use a join to B, and B's a_id column. This
was seen to contain the same value as A's id, and so the join was
trimmed. But this wasn't correct as the join is LEFT JOIN, and for row
A.id = 2 the B.a_id column is NULL.
2013-08-21 22:30:46 +01:00
Simon Charette
63378163f9
Fixed #20943 -- Weakly reference senders when caching their associated receivers
2013-08-21 22:30:45 +01:00
Andrew Godwin
2e7f45a372
Change autodetector changes API to be just one method
2013-08-21 22:25:15 +01:00
Tim Graham
f7290581fe
Fixed a regression with get_or_create and virtual fields.
...
refs #20429
Thanks Simon Charette for the report and review.
2013-08-21 08:30:21 -04:00
Anssi Kääriäinen
b065aeb17f
Fixed #20946 -- model inheritance + m2m failure
...
Cleaned up the internal implementation of m2m fields by removing
related.py _get_fk_val(). The _get_fk_val() was doing the wrong thing
if asked for the foreign key value on foreign key to parent model's
primary key when child model had different primary key field.
2013-08-21 08:32:19 +03:00
Simon Charette
859e678b3d
Oracle also treats NULLs as largests values when ordering.
2013-08-20 12:28:59 -04:00
Anssi Kääriäinen
1ed77e7782
Fixed #20820 -- Model inheritance + m2m fixture loading regression
...
Tests by Tim Graham, report from jeroen.pulles@redslider.net .
2013-08-20 16:54:05 +03:00
Anssi Kääriäinen
8dc76c4b91
Fixed test failure caused by different NULL ordering between backends
2013-08-20 11:33:44 +03:00
Anssi Kääriäinen
905409855c
Fixed #14056 -- Made sure LEFT JOIN aren't trimmed in ORDER BY
...
If LEFT JOINs are required for correct results, then trimming the join
can lead to incorrect results. Consider case:
TBL A: ID | TBL B: ID A_ID
1 1 1
2
Now A.order_by('b__a') did use a join to B, and B's a_id column. This
was seen to contain the same value as A's id, and so the join was
trimmed. But this wasn't correct as the join is LEFT JOIN, and for row
A.id = 2 the B.a_id column is NULL.
2013-08-20 10:55:00 +03:00
Simon Charette
e55ca60903
Fixed #20943 -- Weakly reference senders when caching their associated receivers
2013-08-20 01:53:58 -04:00
Andrew Godwin
b6a957f0ba
Merge remote-tracking branch 'core/master' into schema-alteration
...
Conflicts:
docs/ref/django-admin.txt
2013-08-19 18:30:48 +01:00
Anssi Kääriäinen
7bc57a6d71
Fixed #11881 -- removed junk from aggregation subqueries
...
There were clauses that weren't needed in the subqueries. These were
ORDER BY, SELECT FOR UPDATE and related selections.
2013-08-19 16:15:09 +03:00
Anssi Kääriäinen
7737305a4f
Fixed #12886 -- aggregation over sliced queryset
2013-08-19 16:00:17 +03:00
Andrew Godwin
52edc16086
Add more stringent M2M tests and fix the bug they exposed
2013-08-19 13:50:26 +01:00
Andrew Godwin
5b522cd85a
Minor oracle fixes
2013-08-19 13:12:48 +01:00
Anssi Kääriäinen
4668c142dc
Made Model.__eq__ consider proxy models equivalent
...
Fixed #11892 , fixed #16458 , fixed #14492 .
2013-08-19 09:51:28 +03:00
Harm Geerts
240886183b
Fixed #20829 -- Skip postgis metadata tables with introspection
2013-08-16 21:14:29 +02:00
Andrew Godwin
157604a87f
Oracle schema backend, passes most tests and is pretty complete.
2013-08-13 20:54:57 +01:00
Loic Bistuer
163a34ce4b
Fixed #20883 -- Made model inheritance find parent links in abstract parents
2013-08-13 15:14:11 +03:00
Anssi Kääriäinen
dcdc579d16
Fixed #20874 -- bump_prefix() in nested subqueries
...
Also made some cleanup to build_filter() code by introducing submethods
solve_lookup_type() and prepare_lookup_value().
2013-08-13 14:11:52 +03:00
Andrew Godwin
44f907dd98
Start of getting Oracle to do schema stuff
2013-08-12 20:05:20 +01:00
Andrew Godwin
b61b634628
Fix weird planning issues when already fully migrated.
2013-08-11 15:28:51 +01:00
Andrew Godwin
b4c493ecd3
Remove keep_default from add_field
2013-08-11 14:28:55 +01:00
Andrew Godwin
d985fd7a18
Fix tablespace command
2013-08-11 14:27:42 +01:00
Andrew Godwin
ae19315b4d
Support index_together during model creation
2013-08-11 14:23:31 +01:00
Andrew Godwin
21be9fef7b
Stop being overcautious about Field.rel
2013-08-11 00:01:30 +01:00
Andrew Godwin
7702819441
Update get_constraints with better comments
2013-08-10 23:58:12 +01:00
Andrew Godwin
7970d97a70
Docs tweaks (thanks timgraham)
2013-08-10 20:00:12 +01:00
Andrew Godwin
f093646bfc
Remove pointless comment.
2013-08-09 17:47:13 +01:00
Andrew Godwin
9b4a789eef
Add [y/n] to autodetector questions and allow for default value
2013-08-09 17:45:19 +01:00
Andrew Godwin
ae96ad872f
Remove pointless fetch_results param
2013-08-09 17:42:56 +01:00
Andrew Godwin
fb16ee5a31
Remove commented-out print
2013-08-09 17:41:39 +01:00
Andrew Godwin
9f73629420
utils.importlib is deprecated
2013-08-09 17:36:16 +01:00
Andrew Godwin
588b523233
Merge remote-tracking branch 'core/master' into schema-alteration
...
Conflicts:
django/db/models/options.py
2013-08-09 14:37:37 +01:00
Tim Graham
ddae74b64c
Fixed #9057 -- Added default_permissions model meta option.
...
Thanks hvendelbo for the suggestion and koenb for the draft patch.
2013-08-09 09:19:52 -04:00
Andrew Godwin
de64c4d6e9
Merge remote-tracking branch 'core/master' into schema-alteration
...
Conflicts:
django/core/management/commands/flush.py
django/core/management/commands/syncdb.py
django/db/models/loading.py
docs/internals/deprecation.txt
docs/ref/django-admin.txt
docs/releases/1.7.txt
2013-08-09 14:17:30 +01:00
Anssi Kääriäinen
c7739e30b2
Fixed #17424 -- annotate() + exclude() bug
...
The bug was already fixed by 01b9c3d519
,
so only tests added.
At the same time promote_joins()'s uncoditional flag is gone, it isn't
needed for anything any more.
2013-08-07 12:53:33 +03:00
Alex Cucu
1c64a0f29e
Fixed #19918 -- Modified select_for_update to run on the write database.
2013-08-06 09:50:59 -04:00
Tim Graham
04489c7dbf
Fixed #17667 -- Prevented app loading from skipping nonexistent apps after the first try
...
Thanks ea2100@ for the report and akaariai for the patch.
2013-08-05 13:34:35 -04:00
Curtis Maloney
07876cf02b
Deprecated SortedDict (replaced with collections.OrderedDict)
...
Thanks Loic Bistuer for the review.
2013-08-04 07:09:39 -04:00
Tim Graham
aa830009de
Fixed #17519 -- Fixed missing SQL constraints to proxy models.
...
Thanks thibaultj for the report, jenh for the patch,
and charettes for the tests.
2013-08-02 07:41:56 -04:00
Tim Graham
5df84b268d
Removed unused model option "admin"
2013-08-01 10:27:30 -04:00
Alex Couper
1123f45511
Fixed #20649 -- Allowed blank field display to be defined in the initial list of choices.
2013-07-31 14:12:03 -04:00
Loic Bistuer
acd1d439fd
Fixed #20826 -- Moved Manager.raw() and Manager._insert() to the QuerySet class.
2013-07-31 09:54:00 -04:00
Florian Hahn
e888a9b30d
Fixed #15624 -- Made sure aggregations are present in SELECT
2013-07-31 16:27:58 +03:00
Anssi Kääriäinen
c21e86ab9e
Added field.attname to Options.name_map
...
The change also removed allow_explicit_fk from sql/query.py.
2013-07-31 16:02:36 +03:00
Tai Lee
31e6d58d46
Fixed #20348 -- Consistently handle Promise objects in model fields.
...
All Promise objects were passed to force_text() deep in ORM query code.
Not only does this make it difficult or impossible for developers to
prevent or alter this behaviour, but it is also wrong for non-text
fields.
This commit changes `Field.get_prep_value()` from a no-op to one that
resolved Promise objects. All subclasses now call super() method first
to ensure that they have a real value to work with.
2013-07-31 15:54:17 +03:00
Andrew Godwin
fddc5957c5
Implement allow_migrate for migration operations
2013-07-30 12:34:31 +01:00
Andrew Godwin
12e9804d16
Rename allow_syncdb to allow_migrate
2013-07-30 12:08:59 +01:00
Andrew Godwin
68e0a169c4
Rename pre_ and post_syncdb to *_migrate, with aliases from old names
2013-07-30 11:52:52 +01:00
Shai Berger
6ed579e7eb
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:21:06 +03:00
Claude Paroz
5c1143910e
Removed most of absolute_import imports
...
Should be unneeded with Python 2.7 and up.
Added some unicode_literals along the way.
2013-07-29 20:28:13 +02:00
Claude Paroz
fdd7a355bf
Deprecated django.utils.importlib
...
This was a shim for pre-Python 2.7 support.
2013-07-29 17:10:22 +02:00
Julien Phalip
47c755327b
Fixed a number of minor misspellings.
2013-07-27 18:46:03 -07:00
Andrew Godwin
c8cbdabfab
Fix Python 3 support
2013-07-26 17:08:12 +01:00
Andrew Godwin
52643a69e3
Add --fake option to migrate
2013-07-26 16:47:00 +01:00
Andrew Godwin
3f7113f1d9
Fix timezone warnings if USE_TZ=True
2013-07-26 16:46:48 +01:00
Andrew Godwin
9c6d57ef5a
Prettier imports
2013-07-26 16:40:27 +01:00
Anssi Kääriäinen
7cca8d56d2
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.
2013-07-26 13:13:27 +03:00
Loic Bistuer
31fadc1202
Fixed #20625 -- Chainable Manager/QuerySet methods.
...
Additionally this patch solves the orthogonal problem that specialized
`QuerySet` like `ValuesQuerySet` didn't inherit from the current `QuerySet`
type. This wasn't an issue until now because we didn't officially support
custom `QuerySet` but it became necessary with the introduction of this new
feature.
Thanks aaugustin, akaariai, carljm, charettes, mjtamlyn, shaib and timgraham
for the reviews.
2013-07-26 12:41:27 +03:00
Andrew Godwin
a758c9c186
Add test for creating M2Ms
2013-07-25 16:36:58 +01:00
Anssi Kääriäinen
92476e880c
Fixed ._meta.pk_index() virtual field failure
2013-07-25 16:25:23 +03:00
Tim Graham
31c13a99bb
Fixed #14300 -- Fixed initial SQL location if models is a package.
...
Thanks al_the_x for the report and fheinz for the draft patch.
2013-07-24 06:56:33 -04:00
ersran9
311c1d2848
Fixed #20761 -- Reworded ForeignKey default error message
2013-07-23 22:16:31 +02:00
Tim Graham
ad98b985aa
Fixed test failures introduced in e716518ad2
...
refs #20761
2013-07-23 15:21:29 -04:00
Loic Bistuer
e716518ad2
Fixed #20761 -- Fixed DatabaseError handling in get_or_create and update_or_create.
2013-07-23 09:20:43 -04:00
Anssi Kääriäinen
6b4967e883
Minor change to get_extra_descriptor_filter()
...
Refs #20611 .
2013-07-23 15:34:29 +03:00
Anssi Kääriäinen
4bd5554721
Fixed #20782 -- qs.values().aggregate() failure
...
In the combination of .values().aggregate() the aggregate_select_mask
didn't include the aggregates added. This resulted in bogus query.
Thanks to Trac alias debanshuk for report.
2013-07-23 11:38:38 +03:00
Andrew Godwin
162f7b938f
Make migrate command recognise prefixes and 'zero'.
2013-07-22 19:43:58 +01:00
Andrew Godwin
03ec3219a0
Merge branch 'master' into schema-alteration
...
Conflicts:
django/db/backends/mysql/introspection.py
django/db/backends/oracle/creation.py
django/db/backends/postgresql_psycopg2/creation.py
django/db/models/base.py
django/db/models/loading.py
2013-07-22 19:04:25 +01:00
Tim Graham
2333c9662b
Fixed #14007 -- Added model discovery in models module without the need to specify app_label.
...
Thanks mark@ and Aramgutang for work on the patch.
2013-07-16 19:32:30 -04:00