#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):
> It only happens to work in the lazy loading case because it incurs a query that defers the lookup to the backend. Agreed. Granted, it is still because of the database backend, but strings can be used interchangeably with UUIDs in almost everywhere, for example {{{Toy.objects.filter(pk="00000000-...").exists()}}}. This makes the behaviour in this ticket even more peculiar. > That's what serialization layers are usually for; turn data into their proper model equivalent. Sure thing. As I mentioned I have already changed my code to validate the instance, but this behaviour took me by surprise and it looked like it violates the least astonishment principle. -- Ticket URL: <https://code.djangoproject.com/ticket/35434#comment:8> 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/0107018f49b8dc5b-d0705c62-fab6-46e9-aef4-0e06e9b62962-000000%40eu-central-1.amazonses.com.