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

6 views
Skip to first unread message

Joshua Russo

unread,
Sep 21, 2011, 7:47:45 PM9/21/11
to django...@googlegroups.com
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:

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')

I enforce this particular documentType to occur only once per Event, but in reality the Document - Event relation is many to many. That is why I performed a Max on the to go from Document to a FK relation of Event.

I really only ask out of curiosity. As far as SQL goes, this is completely legit and I plan on modifying Django and submitting a patch. (Unless there's a compelling reason not to)
Reply all
Reply to author
Forward
0 new messages