﻿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
28439	When() crashes with ValidationError with models using UUID as primary key	Dominik Kozaczko	Srinivas Reddy Thatiparthy	"I have a strange issue with `When()` and models using UUID as their pk.

The DB is MySQL 5.6.23 but I've encountered it also on the newest 5.7 version (which is a pain but it's a different story).

I prepared example project here: https://github.com/dekoza/djanbug

The `example.views.myview` includes code ported from the app I'm currently developing - I have several models using UUIDs as their PK and I need to do some annotations an aggregations with some specific cases handled with `Case()/When()` combo.

Even though the db is empty on the example, the view crashes that `'1' is not a valid UUID.` and the only '1' is the one in `When()`

I've also encountered issues with `Count('*', distinct=True)` but right now I'm trying to reproduce it on the example and will post another ticket when I'm done."	Bug	closed	Database layer (models, ORM)	2.2	Normal	fixed	when,		Accepted	0	0	0	0	0	0
