which leads to:
{{{
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/gabejackson/venv/django-1.7/lib/python2.7/site-
packages/django/core/management/__init__.py", line 385, in
execute_from_command_line
utility.execute()
File "/Users/gabejackson/venv/django-1.7/lib/python2.7/site-
packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/gabejackson/venv/django-1.7/lib/python2.7/site-
packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/gabejackson/venv/django-1.7/lib/python2.7/site-
packages/django/core/management/base.py", line 337, in execute
output = self.handle(*args, **options)
File "/Users/gabejackson/venv/django-1.7/lib/python2.7/site-
packages/django/core/management/commands/makemigrations.py", line 111, in
handle
convert_apps=app_labels or None,
File "/Users/gabejackson/venv/django-1.7/lib/python2.7/site-
packages/django/db/migrations/autodetector.py", line 50, in changes
changes = self._detect_changes(convert_apps, graph)
File "/Users/gabejackson/venv/django-1.7/lib/python2.7/site-
packages/django/db/migrations/autodetector.py", line 288, in
_detect_changes
raise ValueError("Cannot resolve operation dependencies")
ValueError: Cannot resolve operation dependencies
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23315>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
I further reduced the model to only 2 apps and 4 models. I found out that
the auto-detector is non-deterministic depending on the alphabetical names
of the models.
If you run the project with the class APackage it will fail with "Cannot
resolve operation deps". If you rename APackage to DPackage (DPackage is
alphabetically now later than DeliveryCountry) and run makemigrations
--dry-run again, it works...
Apparently there is some issue with sorting classes alphabetically. Hope
this helps..
--
Ticket URL: <https://code.djangoproject.com/ticket/23315#comment:1>
* cc: cmawebsite@… (added)
* stage: Unreviewed => Accepted
Comment:
I get the same error with these simple models on the latest code. It's a
circular dependency of ForeignKeys between apps, and I don't see anything
saying that this isn't supported.
--
Ticket URL: <https://code.djangoproject.com/ticket/23315#comment:2>
Comment (by collinanderson):
I've reproduced the project from scratch just to be sure. Here are the
simple models:
https://github.com/collinanderson/ticket23315/commit/39c36c953e96a9eede4f77e161ee3bf96a3ded7b
--
Ticket URL: <https://code.djangoproject.com/ticket/23315#comment:3>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"9247da1032c1b8c98b0fcfb278bbbdbc8edc8783"]:
{{{
#!CommitTicketReference repository=""
revision="9247da1032c1b8c98b0fcfb278bbbdbc8edc8783"
Fixed #23315: Operational dependency fail with mixed create/add
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23315#comment:4>
Comment (by Andrew Godwin <andrew@…>):
In [changeset:"824e02bf836affa182dd4bcb7b3e1796f1389b38"]:
{{{
#!CommitTicketReference repository=""
revision="824e02bf836affa182dd4bcb7b3e1796f1389b38"
[1.7.x] Fixed #23315: Operational dependency fail with mixed create/add
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23315#comment:5>
* status: closed => new
* resolution: fixed =>
Comment:
The new test fails on Python 3.4:
{{{
======================================================================
ERROR [0.001s]: test_circular_dependency_mixed_addcreate
(migrations.test_autodetector.AutodetectorTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jenkins/workspace/django-
master/database/sqlite3/python/python3.4/tests/migrations/test_autodetector.py",
line 1099, in test_circular_dependency_mixed_addcreate
changes = autodetector._detect_changes()
File "/home/jenkins/workspace/django-
master/database/sqlite3/python/python3.4/django/db/migrations/autodetector.py",
line 172, in _detect_changes
self.generate_created_models()
File "/home/jenkins/workspace/django-
master/database/sqlite3/python/python3.4/django/db/migrations/autodetector.py",
line 497, in generate_created_models
dep_app_label = field.rel.to._meta.app_label
AttributeError: 'str' object has no attribute '_meta'
}}}
The string is `"a.person"` (but resolves to `<class 'Person'>` when the
test passes).
--
Ticket URL: <https://code.djangoproject.com/ticket/23315#comment:6>
* owner: nobody => timgraham
* status: new => assigned
Comment:
I'm looking into this. It seems to be a non-deterministic issue, perhaps
ordering related.
--
Ticket URL: <https://code.djangoproject.com/ticket/23315#comment:7>
Comment (by andrewgodwin):
That's odd, because all the other relationships in that test file are fine
under 3.4. It's likely an issue in the State's reconstruction of it. Happy
to look at this instead if you want to hand it over.
--
Ticket URL: <https://code.djangoproject.com/ticket/23315#comment:8>
Comment (by Tim Graham <timograham@…>):
In [changeset:"d1299fce0eeeb2a7749fecafc87260462e75aac9"]:
{{{
#!CommitTicketReference repository=""
revision="d1299fce0eeeb2a7749fecafc87260462e75aac9"
Fixed migrations tests added in refs #23315.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23315#comment:9>
Comment (by Tim Graham <timograham@…>):
In [changeset:"6981eced83ea2d6462b21c12ecea044e02e56d05"]:
{{{
#!CommitTicketReference repository=""
revision="6981eced83ea2d6462b21c12ecea044e02e56d05"
[1.7.x] Fixed migrations tests added in refs #23315.
Backport of d1299fce0e from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23315#comment:10>
* status: assigned => closed
* resolution: => fixed
Comment:
`do_pending_lookups` wasn't resolving the field due to a case mismatch.
--
Ticket URL: <https://code.djangoproject.com/ticket/23315#comment:11>
Comment (by Andrew Godwin <andrew@…>):
In [changeset:"9247da1032c1b8c98b0fcfb278bbbdbc8edc8783"]:
{{{
#!CommitTicketReference repository=""
revision="9247da1032c1b8c98b0fcfb278bbbdbc8edc8783"
Fixed #23315: Operational dependency fail with mixed create/add
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23315#comment:12>