Closed OJFord closed 2 years ago
Keen for someone to have a go at this. A PR with a failing test case would also be a great help.
I do intend to try to get a test case for it - because weirdly I've actually seen it both ways now.
In our tests, and hence I initially thought it not working, it came through as a string as described. Then we saw an issue with it actually running where it was the composite type (the issue being that we tried to change it into one ourselves assuming a string, and it wasn't a string, so some string function didn't exist).
It's not immediately apparent whether the test is doing something differently and both behaviours could be seen in prod too (according to how the QuerySet is constructed, or something) or if it's some how inherent in test vs. real (quirk of its interaction with pytest-django, say). Not got to the bottom of it yet.
Also seems to occur in a regularly declared field (i.e. on the model, not an annotation) when the model is managed = False
(e.g. it's a view).
Ah - nevermind, I forgot to register the type. I suspect this was also the case in my original report, and it worked outside of tests (per comment above) because the type was created outside of Django migrations.
results in
i.e. a
str
rather than the expected (hoped for)CompositeType
.