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
Tim Graham
2456ffa42c
Fixed #20746 -- Removed Python 2.6 specific code/docs
2013-07-14 13:02:55 -04:00
Tim Graham
f2cb94f1c0
Fixed #20740 -- GenericIPAddressField should pass protocol to formfield()
...
Thanks Jeff250.
2013-07-12 16:05:14 -04:00
Karol Sikora
6272d2f155
Fixed #20429 -- Added QuerySet.update_or_create
...
Thanks tunixman for the suggestion and Loic Bistuer for the review.
2013-07-12 08:26:35 -04:00
Tim Graham
95eb68c98f
Fixed #17339 -- Factor out has_result into database backend.
...
Thanks jonash.
2013-07-09 06:41:52 -04:00
Shai Berger
c0a4894dca
Fixed last_executed_query test failure on Oracle
2013-07-08 23:47:02 +03:00
Tim Graham
da79ccca1d
Fixed #6785 -- Made QuerySet.get() fetch a limited number of rows.
...
Thanks Patryk Zawadzki.
2013-07-08 08:33:40 -04:00
Alex Gaynor
43073dbd76
fixed a mis-importt in mysql/base.py
2013-07-08 11:18:06 +10:00
Alex Gaynor
03d9566e0d
A large number of stylistic cleanups across django/db/
2013-07-08 10:39:54 +10:00
Alex Gaynor
0b69a75502
Fixed a bug I introduced in my previosu ommit.
2013-07-08 10:32:04 +10:00
Alex Gaynor
626fa28878
Fixed #13813 -- Comparison of DatabaseWrappers doesn't raise errors.
...
Patch from Lukasz Balcerzak.
2013-07-08 09:35:08 +10:00
Alex Gaynor
c8c22ccdcb
Removed some logic that wasn't needed following removal of some deprecated code.
2013-07-08 08:49:58 +10:00
Andrew Godwin
3a6580e485
Make get_constraints return columns in order
2013-07-02 18:02:20 +01:00
Andrew Godwin
61ff46cf8b
Add AlterIndexTogether operation
2013-07-02 18:02:01 +01:00
Andrew Godwin
dbd3e775c1
Fix get_constraints to do multi-column indexes properly on pg
2013-07-02 12:06:00 +01:00
Andrew Godwin
f343cbf06c
Fix combined alters on PostgreSQL
2013-07-02 11:51:18 +01:00
Andrew Godwin
6a8cfbf07b
Support for index_together in schema backends
2013-07-02 11:43:44 +01:00
Andrew Godwin
3b20af3e96
Autodetection of unique_together changes
2013-07-02 11:25:18 +01:00
Andrew Godwin
67dcea711e
Add unique_together altering operation
2013-07-02 11:19:02 +01:00
Andrew Godwin
b1e0ec06f0
Merge branch 'master' into schema-alteration
2013-07-02 10:49:53 +01:00
Aymeric Augustin
d5589b4cd3
Removed some conditional code only needed under Python 2.6.
2013-07-01 12:02:17 +02:00
Alex Gaynor
b9ebca6a28
Removed a comment that wasn't adding a value.
...
In the intervening years, RelatedField has become less of a hack (though it still is one). Anyone who wants to can re-instate the comment, but please add more details.
2013-06-30 23:32:23 -07:00
Aymeric Augustin
dd9c6bc359
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 .
2013-06-30 15:57:00 +02:00
Aymeric Augustin
acd7b34aaf
Advanced deprecation warnings for Django 1.7.
2013-06-29 18:49:37 +02:00
Claude Paroz
59b0c48ce2
Fixed #18592 -- Prevented crash when accessing MySQL _last_executed
...
Thanks reames at asymmetricventures.com for the report.
2013-06-29 18:44:41 +02:00
Claude Paroz
ea3fe78a9d
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.
2013-06-29 18:08:39 +02:00
Ramiro Morales
6ba69c8456
Removed 'depth' .select_related() argument as per deprecation TL.
2013-06-28 21:48:16 -03:00
Andrew Godwin
904b82759c
Fix Python 3 support
2013-06-28 17:53:49 +01:00
Andrew Godwin
7a47ba6f6a
Merge remote-tracking branch 'core/master' into schema-alteration
...
Conflicts:
django/db/backends/__init__.py
django/db/models/fields/related.py
tests/field_deconstruction/tests.py
2013-06-28 17:32:57 +01:00
Andrew Godwin
48dd1e63bb
Ported over Field.deconstruct() from my schema alteration branch.
...
This is to help other ongoing branches which would benefit from
this functionality.
2013-06-28 17:27:52 +01: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
Andrew Godwin
e2d7e83256
Autodetect ForeignKeys and add dependencies/split on circulars
2013-06-22 17:15:51 +01:00
Gilberto Gonçalves
680b512fc1
Fixed #20587 -- Made convert_values handle None values
2013-06-22 14:05:12 +01:00
Andrew Godwin
48493cff73
Remove EmailField max_length default removal in deconstruct()
2013-06-22 12:56:37 +01:00
Andrew Godwin
cca40703df
Prompt about renames rather than doing them automatically
2013-06-21 15:32:15 +01:00
Andrew Godwin
92a10f5552
Autodetect field renames. HAHAHA. AHAHAHAHA. YES.
2013-06-20 16:02:43 +01:00
Andrew Godwin
47e4b86ddf
Autodetect field alters
2013-06-20 15:19:30 +01:00
Andrew Godwin
80bdf68d6b
Add AlterField and RenameField operations
2013-06-20 15:12:59 +01:00
Andrew Godwin
6f667999e1
Add operation that renames tables
2013-06-20 14:54:11 +01:00
Andrew Godwin
73e30e9d3b
Better naming, and prompt for NOT NULL field addition
2013-06-19 17:01:48 +01:00
Andrew Godwin
41214eaf18
Autodetect fields, have migrate actually work
2013-06-19 16:41:04 +01:00
Andrew Godwin
f25a385a5e
Makemigration command now works
2013-06-19 16:23:52 +01:00
Aymeric Augustin
ffcf24c9ce
Removed several unused imports.
2013-06-19 17:18:40 +02:00
Andrew Godwin
ab5cbae9b7
First stab at some migration creation commands
2013-06-19 15:36:22 +01:00
Andrew Godwin
2ae8a8a77d
Fix test running with new apps stuff/migrate actually running migrations
2013-06-19 15:36:02 +01:00
Andrew Godwin
9daf81b94e
Merge remote-tracking branch 'core/master' into schema-alteration
...
Conflicts:
django/db/models/loading.py
2013-06-19 12:05:23 +01:00
Florian Hahn
2f35c6f10f
Fixed #14930 -- values_list() failure on qs ordered by extra column
...
Thanks lsaffre for the report and simon29, vicould, and Florian Hahn
for the patch.
Some changes done by committer.
2013-06-18 23:56:51 +03:00
Loic Bistuer
ee77d4b253
Fixed #20199 -- Allow ModelForm fields to override error_messages from model fields
2013-06-18 08:01:17 -04:00
Loic Bistuer
f34cfec0fa
Refactored ValidationError to allow persisting error params and error codes as the exception bubbles up
2013-06-18 08:01:17 -04:00
Anssi Kääriäinen
aa22cbd51a
Fixed #20583 -- ORM always uses setup_joins() for join generation
...
There were a couple of places which used Query.join() directly. By
using setup_joins() in these places the code is more DRY, and in
addition there is no need to directly call field.get_joining_columns()
unless the field is the given join_field from get_path_info(). This
makes it easier to make sure a ForeignObject subclass generates joins
correctly in all cases.
2013-06-16 15:44:52 +03:00
Anssi Kääriäinen
5459795ef2
Fixed #20289 -- pickling of dynamic models
2013-06-14 17:05:54 +03:00
Anssi Kääriäinen
89bf7a4525
Fixed #20528 -- regression in select_related join promotion
...
The join used by select_related was incorrectly INNER when the query
had an ORed filter for nullable join that was trimmed away. Fixed this
by forcing the join type to LOUTER even when a join was trimmed away
in ORed queries.
2013-06-14 16:29:06 +03:00
Baptiste Mispelon
dc9c359546
Fixed #20594 -- Add validation to models.SlugField.
...
Thanks carbonXT for the report.
2013-06-13 13:31:57 -04:00
Tim Graham
92c49d6f01
Revert "Fixed #20462 - Fixed sqlite regex lookups for null values and non-string fields."
...
This reverts commit 64041f0e6e
.
lookup.tests.LookupTests.test_regex_non_string fails under Postgres.
We should also try to rewrite the test using an existing model.
2013-06-11 17:55:19 -04:00
Axel Haustant
64041f0e6e
Fixed #20462 - Fixed sqlite regex lookups for null values and non-string fields.
2013-06-11 14:13:40 -04:00
Aymeric Augustin
4daf570b98
Added TransactionTestCase.available_apps.
...
This can be used to make Django's test suite significantly faster by
reducing the number of models for which content types and permissions
must be created and tables must be flushed in each non-transactional
test.
It's documented for Django contributors and committers but it's branded
as a private API to preserve our freedom to change it in the future.
Most of the credit goes to Anssi. He got the idea and did the research.
Fixed #20483 .
2013-06-10 11:24:10 +02:00
Aymeric Augustin
13b7f299de
Added a stealth option to flush to allow cascades.
...
This allows using flush on a subset of the tables without having to
manually cascade to all tables with foreign keys to the tables being
truncated, when they're known to be empty.
On databases where truncate is implemented with DELETE FROM, this
doesn't make a difference. The cascade is allowed, not mandatory.
2013-06-10 11:21:54 +02:00
Aymeric Augustin
79ff1aedd5
Replaced a dict emulating a set with a set.
2013-06-09 14:31:04 +02:00
Andrew Godwin
315ab41e41
Initial stab at a migrate command, it's probably quite a way off.
2013-06-07 18:47:17 +01:00