I posted this in the users group but didn't get any response, so I'm 
bringing it here. 

Is there any particular reason why it's assumed you won't be performing a 
Max on a CharField? 

I tried to create the following QuerySet I get an error out of 
convert_values() of BaseDatabaseOperations in 
django/db/backends/__init__.py:

Document.objects.filter(documentType=1, 
event__eventType=3).annotate(event_date=Max('event__start_date'), 
subcommittee=Max('event__subcommittee__name')).order_by('subcommittee', 
'event_date')

The reason why I performed a Max on the subcommittee name is that the 
relation between Document and Event is actually a many to many, but I 
enforce this particular documentType to only once per Event. 

The fix is easy. Add any character based field types to the last elif in 
convert_values(). I plan on submitting a patch unless there's a compelling 
reason not to

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/mGzHtBFTeOEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to