40 Commits

Author SHA1 Message Date
Florian Apolloner
405b13fe83 Fixed migrate when called inside a transaction.
This is useful for tests manually calling migrate inside a testcase,
for normal usage this should make no difference, since there is no
surrounding transaction after all. If there is one we still try to
leave the transaction in a useable state (for postgres at least).

If this commit turns out to be causing issues, settings savepoint=False
is probably the right fix :)
2014-04-21 15:37:12 +02:00
Aymeric Augustin
0f9560855e Removed legacy transaction management per the deprecation timeline. 2014-03-21 21:06:50 +01:00
Rodolfo Carvalho
0d91225892 Fixed many typos in comments and docstrings.
Thanks Piotr Kasprzyk for help with the patch.
2014-03-03 07:38:09 -05:00
Andrew Godwin
d5df7a0515 Fixed #21969: Fix behaviour of initial_data with migrated apps 2014-02-09 12:22:59 +00:00
Michael Manfre
3ffeb93186 Ensure cursors are closed when no longer needed.
This commit touchs various parts of the code base and test framework. Any
found usage of opening a cursor for the sake of initializing a connection
has been replaced with 'ensure_connection()'.
2014-02-02 12:47:21 -05:00
Aymeric Augustin
bfcc686d22 Removed the only_with_models_module argument of get_model[s].
Now that the refactorings are complete, it isn't particularly useful any
more, nor very well named. Let's keep the API as simple as possible.

Fixed #21689.
2013-12-30 23:59:34 +01:00
Aymeric Augustin
856aaaf2b1 Changed get_migratable_models to use an app config. 2013-12-29 21:25:28 +01:00
Aymeric Augustin
c81fae6b95 Used app_label instead of appname.
The last component of the dotted path to the application module is
consistently referenced as the application "label". For instance it's
AppConfig.label. appname could be confused with AppConfig.name, which is
the full dotted path.
2013-12-28 09:53:02 +01:00
Aymeric Augustin
ce1bc2c94b Made the AppConfig API marginally more consistent.
Eliminated the app_ prefix that was more confusing than useful.
2013-12-26 19:25:09 +01:00
Aymeric Augustin
1716b7ce5a Renamed AppCache to Apps.
Also renamed app_cache to apps and "app cache" to "app registry".

Deprecated AppCache.app_cache_ready() in favor of Apps.ready().
2013-12-24 12:25:17 +01:00
Aymeric Augustin
2fef9e5375 Moved apps back in the toplevel django namespace.
Reverted 4a56a93cc458e9ab4dcab95d9f5067d4975dd1a2.
2013-12-22 11:39:55 +01:00
Aymeric Augustin
65cd74be8e Stopped iterating on INSTALLED_APPS.
Used the app cache's get_app_configs() method instead.
2013-12-22 11:39:18 +01:00
Aymeric Augustin
4a56a93cc4 Moved the new app cache inside core. 2013-12-17 10:17:46 +01:00
Aymeric Augustin
5ba743e262 Made it possible to create apps without a models module.
This commit reverts f44c4a5d0f and 39bbd165.

django.test.simple will be updated in a separate commit as it requires
invasive changes.
2013-12-17 10:17:45 +01:00
Aymeric Augustin
2732edc5f2 Deprecated get_apps(). 2013-12-17 10:17:45 +01:00
Aymeric Augustin
8662654d6d Removed module-level functions for the app cache.
Since the original ones in django.db.models.loading were kept only for
backwards compatibility, there's no need to recreate them. However, many
internals of Django still relied on them.

They were also imported in django.db.models. They never appear in the
documentation, except a quick mention of get_models and get_app in the
1.2 release notes to document an edge case in GIS. I don't think that
makes them a public API.

This commit doesn't change the overall amount of global state but
clarifies that it's tied to the app_cache object instead of hiding it
behind half a dozen functions.
2013-12-17 10:17:44 +01:00
Aymeric Augustin
860c2c8bc5 Moved django.db.models.loading to django.apps.cache.
This commit doesn't contain any code changes; it's purely a refactoring.
2013-12-17 10:17:43 +01:00
Andrew Godwin
3b8e46cbc7 Migration VCS conflict detection and --merge for makemigrations 2013-12-04 16:01:49 +00:00
Andrew Godwin
1d20e6df95 Migrate prompts if you need makemigrations, runserver prompts for migrate 2013-12-04 13:34:01 +00:00
Andrew Godwin
e9cb333bc3 Auto-apply initial migrations if their tables exist already. 2013-10-30 15:17:49 +00:00
Claude Paroz
650b6fd90e Add get_migratable_models util method to ConnectionRouter 2013-10-16 18:02:49 +02:00
Andrew Godwin
763ac8b642 First pass on squashmigrations command; files are right, execution not. 2013-10-16 12:00:07 +01:00
Markus Holtermann
a772ea8117 Fixed #21115 -- Fixed NameError in migrate --list command 2013-09-17 12:53:59 -04:00
Andrew Godwin
0b7cf56e28 Add -l alias for migrate --list 2013-09-06 17:00:38 -05:00
Andrew Godwin
9f6e6009a4 Add --list option to migrate command 2013-09-06 11:06:19 -05:00
Simon Charette
11cd7388f7 Fixed #20989 -- Removed useless explicit list comprehensions. 2013-08-30 10:57:51 -04:00
Andrew Godwin
9f73629420 utils.importlib is deprecated 2013-08-09 17:36:16 +01:00
Andrew Godwin
679627660f Remove useless override of self.style 2013-08-09 17:34:35 +01: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
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
Andrew Godwin
d5ca169334 Fix "OK" alignment in migrate output 2013-07-26 16:52:17 +01:00
Andrew Godwin
52643a69e3 Add --fake option to migrate 2013-07-26 16:47:00 +01:00
Andrew Godwin
c1ed21fa9e Use new transaction API in syncdb section of migrate 2013-07-26 16:39:44 +01:00
Andrew Godwin
6b39010d57 Remove nasty error message checking hack 2013-07-26 16:33:32 +01:00
Andrew Godwin
00276e0414 Add tests for the migrate command and fix a bug they exposed 2013-07-25 13:52:35 +01:00
Andrew Godwin
162f7b938f Make migrate command recognise prefixes and 'zero'. 2013-07-22 19:43:58 +01:00
Andrew Godwin
41214eaf18 Autodetect fields, have migrate actually work 2013-06-19 16:41:04 +01:00
Andrew Godwin
ab5cbae9b7 First stab at some migration creation commands 2013-06-19 15:36:22 +01: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