#26186: When extending from abstract model, ForeignKey points to wrong 
application
-------------------------------------+-------------------------------------
     Reporter:  skyjur               |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.9
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by skyjur):

 * status:  closed => new
 * resolution:  invalid =>


Old description:

> This might be related to https://code.djangoproject.com/ticket/25858
>
> I have following code:
>
> '''app_A/models.py:'''
>
> {{{
> class AbstractModel1(Model):
>     class Meta:
>         abstract = True
>

> class AbstractModel2(Model):
>     model1 = ForeignKey('Model1')
>
>     class Meta:
>           abstract = True
>

> class Model1(AbstractModel1):
>     pass
>
> class Model2(AbstractModel12):
>     pass
> }}}
>

> '''app_B/models.py:'''
>

> {{{
> from app_A.models import AbstractModel1, AbstractModel2
>
> class Model1(AbstractModel1):
>     pass
>
> class Model2(AbstractModel12):
>     pass
> }}}
>
> in Django 1.8, the `app_B.Model2.model1` would point to `app_B.Model1`,
> but in Django 1.9.2 it points to `app_A.Model1` so my code no longer
> works.

New description:

 This might be related to https://code.djangoproject.com/ticket/25858

 I have following code:

 '''app_A/models.py:'''

 {{{
 class AbstractModel1(Model):
     class Meta:
         abstract = True


 class AbstractModel2(Model):
     model1 = ForeignKey('Model1')

     class Meta:
           abstract = True
 }}}

 '''app_A/models.py:'''

 {{{
 from .abstract import AbstractModel1, AbstractModel12

 class Model1(AbstractModel1):
     pass

 class Model2(AbstractModel12):
     pass
 }}}


 '''app_B/models.py:'''


 {{{
 from app_A.abstract import AbstractModel1, AbstractModel2

 class Model1(AbstractModel1):
     pass

 class Model2(AbstractModel12):
     pass
 }}}

 in Django 1.8, the `app_B.Model2.model1` would point to `app_B.Model1`,
 but in Django 1.9.2 it points to `app_A.Model1` so my code no longer
 works.


 Test case can be found: https://github.com/skyjur/django-
 ticketing/tree/master/ticket_26186

--

--
Ticket URL: <https://code.djangoproject.com/ticket/26186#comment:3>
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/064.16303ca8a258cb465a7c5c36e86a1aa3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to