#27460: GenericRelation doesn't work from AbstractClass to AbstractClass in 
Django
1.10(.3)
-------------------------------------+-------------------------------------
               Reporter:  coldib     |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:             |        Version:  1.10
  Uncategorized                      |       Keywords:  GenericRelation,
               Severity:  Normal     |  Abstract, ContentFramework
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Creating the following models does work in Django 1.9, however in Django
 1.10 the following error is raised **as soon as the class that inherits is
 created** (in the example as soon as class DetailTest is created):

 {{{
 <function make_generic_foreign_order_accessors at 0x7f5444873488>:
 (models.E022) <function make_generic_foreign_order_accessors at
 0x7f5444873488> contains a lazy reference to testac.abstractmaster, but
 app 'testac' doesn't provide model 'abstractmaster'.
 testac.DetailTest.relatedMasterModel: (fields.E307) The field
 testac.DetailTest.relatedMasterModel was declared with a lazy reference to
 'testac.abstractmaster', but app 'testac' doesn't provide model
 'abstractmaster'.
 }}}


 **models.py**

 {{{
 from __future__ import unicode_literals

 from django.db import models

 from django.contrib.contenttypes.fields import GenericForeignKey,
 GenericRelation
 from django.contrib.contenttypes.models import ContentType


 class AbstractMaster (models.Model):
     class Meta: abstract=True

     detailModel_type = models.ForeignKey(ContentType, blank=True,
 null=True)
     detailModel_id = models.PositiveIntegerField(blank=True, null=True)
     detail_Model = GenericForeignKey('detailModel_type', 'detailModel_id')

 class AbstractDetail (models.Model):
     class Meta: abstract=True

     masterModel_type = models.ForeignKey(ContentType, blank=True,
 null=True)
     masterModel_id = models.PositiveIntegerField(blank=True, null=True)
     master_Model = GenericForeignKey('masterModel_type', 'masterModel_id')

     relatedMasterModel = GenericRelation(AbstractMaster,
 object_id_field='detailModel_id', content_type_field='detailModel_id',
 related_query_name='%(app_label)s_%(class)s_detail_model')

 class MasterTest (AbstractMaster):
     pass

 class DetailTest (AbstractDetail):
     pass
 }}}

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

Reply via email to