mirror of
https://github.com/django/django.git
synced 2025-10-29 00:26:07 +00:00
[1.8.x] Fixed #24912 -- Fixed prefetch_related failure for UUIDField primary keys
This resolves a problem on databases besides PostgreSQL when using
prefetch_related with a source model that uses a UUID primary key.
Backport of bfb5b7150f from master
This commit is contained in:
@@ -954,7 +954,10 @@ def create_many_related_manager(superclass, rel):
|
||||
getattr(result, '_prefetch_related_val_%s' % f.attname)
|
||||
for f in fk.local_related_fields
|
||||
),
|
||||
lambda inst: tuple(getattr(inst, f.attname) for f in fk.foreign_related_fields),
|
||||
lambda inst: tuple(
|
||||
f.get_db_prep_value(getattr(inst, f.attname), connection)
|
||||
for f in fk.foreign_related_fields
|
||||
),
|
||||
False,
|
||||
self.prefetch_cache_name,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user