﻿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
35928	[contenttypes] GenericRelation uses wrong primary key type if set to models.UUIDField	Jon Eyolfson		"For a minimal example, if I have the following:

{{{
class Delivery(models.Model):

    id = models.UUIDField(primary_key=True, editable=False)
    content_type = models.ForeignKey(
        ContentType,
        on_delete=models.CASCADE,
        null=True,
        blank=True,
        editable=False,
    )
    object_id = models.PositiveBigIntegerField(
        blank=True,
        null=True,
        editable=False,
    )
    content_object = GenericForeignKey(""content_type"", ""object_id"")

class Other(models.Model):

    delivery = GenericRelation(Delivery, related_query_name=""other"")
}}}

If I use `delivery.other.all().query` I see the wrong primary key:

{{{
SELECT /* SNIP */ WHERE ""delivery"".""id"" = 269290806699601176541887178676879701060
}}}

If I look at a normal query with the primary key on Delivery, like `Delivery.objects.filter(pk=delivery_pk).query`, I see:

{{{
SELECT /* SNIP */ WHERE ""delivery"".""id"" = ca9785d8a6e311ef874b0ad61d0b3444
}}}

This causes SQLite to show the following error:

{{{
OverflowError: Python int too large to convert to SQLite INTEGER
}}}

I assume because GenericRelation is converting the UUID to an integer, which would cause the lookup to fail anyways."	Bug	closed	contrib.contenttypes	5.1	Normal	duplicate	GenericRelation, UUIDField		Unreviewed	0	0	0	0	0	0
