#27460: GenericRelation doesn't work from AbstractClass to AbstractClass in 
Django
1.10(.3)
-------------------------------------+-------------------------------------
     Reporter:  Wolfgang Grim        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Other)         |                  Version:  1.10
     Severity:  Normal               |               Resolution:
     Keywords:  GenericRelation,     |             Triage Stage:
  Abstract, ContentFramework         |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Alex Hill):

 I'm pretty sure this is just a more explicit failure of something that
 didn't work before. You can create the models as described, but see it
 blow up in 1.9 in the sample below when you actually try to use it.

 I might be thinking about this wrong, but what would a GenericRelation to
 an abstract model mean? Which model would queries on the field yield
 instances of?

 Wolfgang - can you provide an example of how you were successfully using
 this in 1.9?

 {{{
 >>> from ag.models import MasterTest, DetailTest
 >>> mt = MasterTest.objects.create()
 >>> dt = DetailTest.objects.create()
 >>> mt.detail_Model = dt
 >>> mt.save()
 >>> dt.master_Model = mt
 >>> dt.save()
 >>>
 >>> dt.relatedMasterModel.all()
 Traceback (most recent call last):
   File "/home/alexh/djexperiments/env/lib/python3.5/site-
 packages/django/core/management/commands/shell.py", line 69, in handle
     self.run_shell(shell=options['interface'])
   File "/home/alexh/djexperiments/env/lib/python3.5/site-
 packages/django/core/management/commands/shell.py", line 61, in run_shell
     raise ImportError
 ImportError

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "<console>", line 1, in <module>
   File "/home/alexh/djexperiments/env/lib/python3.5/site-
 packages/django/db/models/fields/related_descriptors.py", line 468, in
 __get__
     return self.related_manager_cls(instance)
   File "/home/alexh/djexperiments/env/lib/python3.5/site-
 packages/django/utils/functional.py", line 33, in __get__
     res = instance.__dict__[self.name] = self.func(instance)
   File "/home/alexh/djexperiments/env/lib/python3.5/site-
 packages/django/contrib/contenttypes/fields.py", line 448, in
 related_manager_cls
     self.rel.model._default_manager.__class__,
 AttributeError: type object 'AbstractMaster' has no attribute
 '_default_manager'
 >>>
 }}}

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

Reply via email to