I was curious, so I took a look at how django does the year/day/month
selects.  They use a backend specific lookup.  This is how you could
do it using postgres.

em.LoggedEvent.objects.filter().extra(where=['extract(MINUTE from
event_loggedevent.when) < 20'])

SQLite doesn't support extract, so django fakes it.  It looks like
Mysql does.

If you have a small number of items you could do

vals=em.LoggedEvent.objects.filter().values('id','when')
matches=[d['id'] for d in vals if d['when'].minute < 20]
events=LoggedEvent.objects.filter(pk__in=matches)





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to