#35301: Overriding a @property of an abstract model with a GenericRelation 
causes a
models.E025 error.
-------------------------------------+-------------------------------------
     Reporter:  Sage Abdullah        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Sage Abdullah):

 Thanks both! Here's a much more minimal reproduction that still somewhat
 makes sense.

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


 class Generic(models.Model):
     content_type = models.ForeignKey(
         ContentType,
         related_name="+",
         on_delete=models.CASCADE,
     )
     object_id = models.CharField(max_length=255)
     content_object = GenericForeignKey()


 class Abstract(models.Model):
     @property
     def generics(self):
         return Generic.objects.filter(
             content_type=ContentType.objects.get_for_model(self),
             object_id=str(self.pk),
         )

     class Meta:
         abstract = True


 class Concrete(Abstract):
     generics = GenericRelation(Generic, related_query_name="concrete")
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35301#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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e3d447cde-2e0b9fcb-a17a-4e63-a19c-5e99dabbe0e0-000000%40eu-central-1.amazonses.com.

Reply via email to