#35434: prefetch_related_objects fails to cache UUID FKs when the string representation of a UUID is used -------------------------------------+------------------------------------- Reporter: Selcuk Ayguney | Owner: Selcuk | Ayguney Type: Bug | Status: assigned Component: Database layer | Version: dev (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Comment (by Selcuk Ayguney):
True, I already implemented a similar workaround in the codebase I was working on when I spotted this issue, and honestly I'm not sure if this is a wontfix or a legitimate bug. I haven't performed any benchmark either. My rationale was that the usual Django deferred lookup works when a {{{str}}} is used, but it only fails when {{{prefetch_related_objects}}} is used, so this looked like the more consistent behaviour. I don't think other types such as {{{DecimalField}}} etc are commonly used as primary keys. In my real world example the model instance is instantiated from a JSON object in a generic way, and foreign keys are set using the {{{attname}}}s where it is not possible to know the actual data type. -- Ticket URL: <https://code.djangoproject.com/ticket/35434#comment:6> 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/0107018f49a95e9e-a8707c92-adab-42eb-91b0-7fcd3bcecf65-000000%40eu-central-1.amazonses.com.