﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29913	prefetch_related() crash with foreign key to model with non-abstract base class and UUID pk	Alexei Komissarov	nobody	"I have this models:

{{{
class Vehicle(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    created_date = models.DateTimeField(verbose_name=""Created date"", auto_now_add=True)

class Car(Vehicle):
    Name = models.CharField(""Name"", max_length=255)    

class Item(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    car = models.ForeignKey(
        Car, related_name=""items"", on_delete=models.PROTECT)
}}}

I develop with SQLite db which doesn't support UUID columns.
When I query Items I get item with car_id - hex value. I debuged application and found that in {{{DatabaseOperations.get_db_converters()}}} {{{internal_type}}} for column car is OneToOneField and it didn't have {{{self.convert_uuidfield_value}}} of course.

This issue is reason of exception in function {{{prefetch_related}}}:
{{{
Exception Type:	KeyError
Exception Value:	
('27156424-a53d-4b4e-a909-04ceba6c65e1',)
Exception Location:	C:\Source\InMeta.py\inmeta\venv\lib\site-packages\django\db\models\fields\related_descriptors.py in get_prefetch_queryset, line 611
}}}}"	Bug	closed	Database layer (models, ORM)	2.1	Normal	duplicate			Unreviewed	0	0	0	0	0	0
