diary livejournal fossils
Geekiness underneath
So I'm building querysets in Django, and I think I'm in love. Not only can you chain query sets together - that is, you can specify multiple things to search for, such as the title, duration and whatnot - but you can chain across relationships. So, I can search for a song in the Score table that contains 'butt' in the title regardless of case, and specify that it's only by a certain composer, which is a completely separate table.
All through creative use of underscores.
scores = Score.objects.filter(title__icontains = 'butt').filter(client__full_name__icontains = 'matthew scott')
Just creamed my pants. :