On 3/11/2015 9:55 AM, Alex Heyden wrote:
I tried putting the model back in its original module with some much
smaller changes, but I'm getting the same error. The error is nonsense
in the current context.
Is there some intermediate state saved somewhere when you try to run
makemigrations?
Not as far as I can tell. I too have had difficulty moving models
between apps. It is in my too-hard basket for the moment. However ...
When I try again I'll create the model-to-be-moved in its new app and
get that working properly. I would definitely do a makemigration but
edit the migration file prior to migrating to use a forwards_func()
method to get the data across and entrenched in its proper relations
with other models on creation. Finally, when all is working I'd bravely
drop the old model in a separate migration.
hth
Mike
On Mon, Nov 2, 2015 at 4:34 PM, Alex Heyden <[email protected]
<mailto:[email protected]>> wrote:
Traceback first:
./manage.py makemigrations
Traceback (most recent call last):
 File "./manage.py", line 10, in <module>
  execute_from_command_line(sys.argv)
 File
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/core/management/__init__.py",
line 351, in execute_from_command_line
  utility.execute()
 File
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/core/management/__init__.py",
line 343, in execute
  self.fetch_command(subcommand).run_from_argv(self.argv)
 File
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/core/management/base.py",
line 394, in run_from_argv
  self.execute(*args, **cmd_options)
 File
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/core/management/base.py",
line 445, in execute
  output = self.handle(*args, **options)
 File
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/core/management/commands/makemigrations.py",
line 125, in handle
  migration_name=self.migration_name,
 File
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/db/migrations/autodetector.py",
line 43, in changes
  changes = self._detect_changes(convert_apps, graph)
 File
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/db/migrations/autodetector.py",
line 110, in _detect_changes
  self.old_apps = self.from_state.concrete_apps
 File
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/db/migrations/state.py",
line 170, in concrete_apps
  self.apps = StateApps(self.real_apps, self.models,
ignore_swappable=True)
 File
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/db/migrations/state.py",
line 248, in __init__
  raise ValueError(msg.format(field=operations[0][1],
model=lookup_model))
ValueError: Lookup failed for model referenced by field
sdd.Documentation.opportunity: sdd.......governance.models.Opportunity
Needless to say, sdd.......governance.models.Opportunity is not a
valid path to anything.
The Opportunity model was moved from the sdd application to the
governance application. Documentation has a foreign key to
Opportunity. The Python itself is correct. It used to be a direct
reference to the class in the module, now it's an imported
reference. All of the foreign keys are handled in the same way.
Nothing is done by string.
I'm ok with a one-off solution for the migration, but I'm more
interested in /why/Â the model path is so far off and what I might
have done to cause it.
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/d5d6fcf9-8b76-4448-81fb-e38765b66d03%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/d5d6fcf9-8b76-4448-81fb-e38765b66d03%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CA%2Bv0ZYWOTbagf0NUYy9%2BrCwQNPjaDJzdZAaOgCkm7ox7%2BXY60A%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CA%2Bv0ZYWOTbagf0NUYy9%2BrCwQNPjaDJzdZAaOgCkm7ox7%2BXY60A%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/563840E7.7060103%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.