#33651: Support prefetch GenericForeignKey with custom queryset.
-------------------------------------+-------------------------------------
Reporter: elonzh | Owner: nobody
Type: New | Status: new
feature |
Component: Database | Version: 4.0
layer (models, ORM) |
Severity: Normal | Keywords: GenericForeignKey
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
For example:
{{{
class Node(models.Model):
content_type = models.ForeignKey(ContentType,
on_delete=models.CASCADE)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey("content_type", "object_id")
class AbstractNodeItem(models.Model):
name = models.CharField(max_length=100)
class ItemA(AbstractNodeItem):
a_content = models.TextField()
class ItemB(AbstractNodeItem):
b_content = models.TextField()
}}}
Currently we can't list all node with only `content_object.name`
prefetched.
--
Ticket URL: <https://code.djangoproject.com/ticket/33651>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701803bc1a67a-357a38a1-d62e-45f2-9483-b8fd839c7af9-000000%40eu-central-1.amazonses.com.