#26264: values_list with flat=True doesn't make sense with prefetch_related
----------------------------------------------+--------------------
Reporter: agmond | Owner: nobody
Type: Bug | Status: new
Component: Database layer (models, ORM) | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
Assuming these models:
{{{#!python
class Temp(models.Model):
pass
class TempUuid(models.Model):
uuid = models.UUIDField(default=uuid.uuid4, editable=False)
temp = models.ForeignKey(Temp)
}}}
The result of the following code:
{{{#!python
>>> temp = Temp.objects.create()
>>> TempUuid.objects.create(temp=temp)
>>> TempUuid.objects.prefetch_related('temp').values_list('uuid',
flat=True)
}}}
is:
{{{#!python
TypeError: UUID objects are immutable
}}}
Note that there's no exception when removing the `flat=True`.
--
Ticket URL: <https://code.djangoproject.com/ticket/26264>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/049.2f3585a9fa87eec8f4181105478a9c6f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.