Commit Graph

29 Commits

Author SHA1 Message Date
Andrew Gorcester 956bd64424 Fixed #22397 -- Issues removing M2M field with explicit through model
Changed the migration autodetector to remove models last so that FK
and M2M fields will not be left as dangling references. Added a check
in the migration state renderer to error out in the presence of
dangling references instead of leaving them as strings. Fixed a bug
in the sqlite backend to handle the deletion of M2M fields with
"through" models properly (i.e., do nothing successfully).

Thanks to melinath for report, loic for tests and andrewgodwin and
charettes for assistance with architecture.
2014-04-18 16:44:47 -04:00
Simon Charette 0d397e5a5b Revert "Fixed #22397 -- Issues removing M2M field with explicit through model."
This reverts commit 00e3b9a2a9.

It's causing a regression when tested with the proxy_model_inheritance tests.
2014-04-18 01:27:30 -04:00
Andrew Gorcester 00e3b9a2a9 Fixed #22397 -- Issues removing M2M field with explicit through model.
Changed the migration autodetector to remove models last so that FK
and M2M fields will not be left as dangling references. Added a check
in the migration state renderer to error out in the presence of
dangling references instead of leaving them as strings. Fixed a bug
in the sqlite backend to handle the deletion of M2M fields with
"through" models properly (i.e., do nothing successfully).

Thanks to melinath for report, loic for tests and andrewgodwin and
charettes for assistance with architecture.
2014-04-17 12:54:35 -04:00
Tim Graham 42336c84a0 Fixed #22331 -- Made MigrationAutodetector ignore unmanaged models.
This commit reverts 69d4b1c and tackle the issue from a different angle.
Models remain present in the project state, but are now ignored by the
autodetector.
2014-03-25 18:30:58 -04:00
Loic Bistuer 69d4b1c3ea Fixed #22331 -- Fixed migrations ProjectState to ignore unmanaged models. 2014-03-25 10:33:44 -04:00
Loic Bistuer 6436f1fad9 Fixed #21893 -- ModelState didn't account for MTI parents inherited from abstract models. 2014-03-05 03:25:14 +07:00
Anubhav Joshi bb2ca9fe6c Fixed #22172 -- Allowed index_together to be a single list (rather than list of lists)..
Thanks EmilStenstrom for the suggestion.
2014-03-01 15:44:42 -05:00
Alex Gaynor be8173af51 Fixed a small collection of flake8 violations that had snuck in 2014-01-19 21:15:31 -06:00
Andrew Godwin 51832c8aec Remove other unicode literal 2014-01-19 18:57:59 +00:00
Andrew Godwin 3f1a008266 Fixed #21664: Multi-table inheritance was duplicating _ptr fields 2014-01-19 18:35:49 +00:00
Aymeric Augustin 7ed20e0153 Populated Apps instances immediately by default. 2013-12-30 22:11:17 +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 4a56a93cc4.
2013-12-22 11:39:55 +01:00
Aymeric Augustin 0242c56fd8 Deborgified the app cache.
Improved Andrew's hack to create temporary app caches to handle
migrations. Now the main app cache has a "master" flag set to True
(which is a non-default keyword argument, thus unlikely to be used by
mistake). Other app cache instances have "master" set to False.

The only sanctioned way to access the app cache is by importing
django.core.apps.app_cache.

If you were instanciating an app cache and relying on the Borg pattern,
you'll have to refactor your code.
2013-12-17 21:53:18 +01:00
Aymeric Augustin 4a56a93cc4 Moved the new app cache inside core. 2013-12-17 10:17:46 +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
Baptiste Mispelon 19e4374971 Fixed ModelState breaking when unique_together has unhashable elements. 2013-12-06 15:22:52 +01:00
Baptiste Mispelon aba75b0d71 Fixed TypeError when rendering ModelState with multiple bases. 2013-12-06 00:55:31 +01:00
Andrew Godwin 5e63977c0e Fixed #21438: makemigrations now detects ManyToManyFields 2013-11-27 15:28:33 +00:00
Alasdair Nicol c3aa2948c6 Fixed #21298 -- Fixed E301 pep8 warnings 2013-10-23 13:45:03 +01:00
Tim Graham 1dae4ac177 Whitespace cleanup.
* Removed trailing whitespace.
* Added newline to EOF if missing.
* Removed blank lines at EOF.
* Removed some stray tabs.
2013-10-10 16:49:20 -04:00
Andrew Godwin 05656f2388 Add equality support for Project/ModelState 2013-09-25 13:47:46 +01:00
Andrew Godwin be983ee403 Also test failure case of ProjectState dependency resolution 2013-09-06 12:18:24 -05:00
Andrew Godwin cdeff3acc2 Project/ModelState now correctly serialize multi-model inheritance 2013-09-06 12:16:03 -05:00
Loic Bistuer 34d52fd32e Fixed #21010 -- Changed ModelState to only copy _meta.local_fields. 2013-09-04 14:05:59 -04:00
Andrew Godwin 67dcea711e Add unique_together altering operation 2013-07-02 11:19:02 +01:00
Andrew Godwin 264f8650e3 ModelState now freezes options and bases 2013-05-19 12:35:17 +02:00
Andrew Godwin 38a8cf1cdc Fix state tests a little 2013-05-18 18:30:34 +02:00
Andrew Godwin 7d041b9394 Split up test and make the State classes a bit better. 2013-05-18 13:49:56 +02:00