#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
-------------------------------------+-------------------------------------
Description changed by skyjur:
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
> }}}
>
> '''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
New description:
This might be related to https://code.djangoproject.com/ticket/25858
I have following code:
'''app_A/abstract.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:4>
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.3b116624dbfa92cbc73533e6e049fd68%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.