#29574: Django Foreign Key Mismatch
-----------------------------------------+------------------------
               Reporter:  josephbiko     |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  2.1
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 Django Foreign key's do not track the models DB when the model is
 inherited from abstract class.


   {{{
 class A(Model):
    class Meta:
       abstract = True
 class B(A):
    pass
 class C(Model):
    fk = foreignkey(B,on_delete=models.CASCADE)
 }}}

 now model B is in table 1 and C points to table 1.
   {{{
 class A(Model):
    pass
 class B(A):
    pass
 class C(Model):
    fk = foreignkey(B,on_delete=models.CASCADE)
 }}}
 Now Model B is in table 2 with Model A, however C is still pointing to
 table 1, which leads to a foreign key mismatch error when you try to add
 an instance of B

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29574>
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/053.2ef5eea998d2cc90b7352adb0003a707%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to