#24310: Data migration for model, that inherited from unmigrated app's model and
have FK
-------------------------------+--------------------
     Reporter:  GeyseR         |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Migrations     |    Version:  1.7
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 I have problem with migrating data in my project.
 I've implemented my own comment model inherited from {{{
 django.contrib.comments.Comment }}} model, but this can be any concrete
 model from unmigrated app.
 And now I want to migrate some data to my comment model. But I can't get
 full model with foreign keys, because
 
[https://github.com/django/django/blob/master/django/db/migrations/state.py#L143
 this] and then
 
[https://github.com/django/django/blob/master/django/db/migrations/state.py#L255
 this] lines throw FK away from model and finally I get this exception:
 {{{
 Traceback (most recent call last):
   File "./manage.py", line 10, in <module>
     execute_from_command_line(sys.argv)
   File "/home/geyser/.virtualenvs/ostankino_crm/local/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 385, in
 execute_from_command_line
     utility.execute()
   File "/home/geyser/.virtualenvs/ostankino_crm/local/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 377, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/home/geyser/.virtualenvs/ostankino_crm/local/lib/python2.7/site-
 packages/django/core/management/base.py", line 288, in run_from_argv
     self.execute(*args, **options.__dict__)
   File "/home/geyser/.virtualenvs/ostankino_crm/local/lib/python2.7/site-
 packages/django/core/management/base.py", line 338, in execute
     output = self.handle(*args, **options)
   File "/home/geyser/.virtualenvs/ostankino_crm/local/lib/python2.7/site-
 packages/django/core/management/commands/migrate.py", line 161, in handle
     executor.migrate(targets, plan, fake=options.get("fake", False))
   File "/home/geyser/.virtualenvs/ostankino_crm/local/lib/python2.7/site-
 packages/django/db/migrations/executor.py", line 68, in migrate
     self.apply_migration(migration, fake=fake)
   File "/home/geyser/.virtualenvs/ostankino_crm/local/lib/python2.7/site-
 packages/django/db/migrations/executor.py", line 102, in apply_migration
     migration.apply(project_state, schema_editor)
   File "/home/geyser/.virtualenvs/ostankino_crm/local/lib/python2.7/site-
 packages/django/db/migrations/migration.py", line 105, in apply
     operation.database_forwards(self.app_label, schema_editor,
 project_state, new_state)
   File "/home/geyser/.virtualenvs/ostankino_crm/local/lib/python2.7/site-
 packages/django/db/migrations/operations/special.py", line 117, in
 database_forwards
     self.code(from_state.render(), schema_editor)
   File
 
"/home/geyser/coding/ostankino_crm/comments_crm/migrations/0003_auto_20150209_1643.py",
 line 33, in forward
     comment = MyComment(content_type=ct, object_pk=order.id,
 comment_type='complain', complain_status=2 if order.complaint_resolved
 else None, user=change_user, comment=order.status_desc,
 submit_date=change_date)
   File "/home/geyser/.virtualenvs/ostankino_crm/local/lib/python2.7/site-
 packages/django/db/models/base.py", line 452, in __init__
     raise TypeError("'%s' is an invalid keyword argument for this
 function" % list(kwargs)[0])
 TypeError: 'user' is an invalid keyword argument for this function
 }}}

 Also I've attached minimal project that reproduces this error, just
 execute {{{ ./manage.py migrate }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24310>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.1b82243ff6a4a161047ac8d5ccd4a56d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to