#24282: Cannot Modify Foreign Keys Within Data Migrations
---------------------------------+-----------------------
     Reporter:  jeffasinger      |      Owner:  nobody
         Type:  Bug              |     Status:  new
    Component:  Migrations       |    Version:  1.8alpha1
     Severity:  Release blocker  |   Keywords:
 Triage Stage:  Unreviewed       |  Has patch:  0
Easy pickings:  0                |      UI/UX:  0
---------------------------------+-----------------------
 The following data migration works in 1.7, but fails in 1.8a1

 {{{
 def forwards(apps, schema_editor):
     A = apps.get_model('app_name', 'A')
     B = apps.get_model('app_name', 'B')

     a = A.objects.create()
     b = B(a=a)
 }}}

 Fails with:
 {{{
     ValueError: Cannot assign "<A: A object>": "B.a" must be a "A"
 instance.
 }}}

 I believe that this is because the model classes returned `apps.get_model`
 aren't necessarily instances of the right type.

 I'd be happy to create a failing test case, however, I'm new to the
 project, and would like a little direction on where that should go.

--
Ticket URL: <https://code.djangoproject.com/ticket/24282>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/054.bdf2c9a80a2c81e67bf2de0bac9f0d96%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to