Archive for September 2008

Stacking Django Q lookups in OR/AND fashion

Oct 1, 2008 12:49:00 AM

Just a quick one so I won't forget, I was wondering how to compile a OR lookup stack from a list of Q objects.

>>> # Import the operator built-in module
>>> import operator
>>> from django.db.models import Q
>>> from mytest.models import Test
>>> # Create an arbitrary set of test-data
>>> for x in xrange(0, 99): Test(test=x).save()
>>> # The lookups
>>> lookups = [Q(test=1), Q(test=2), Q(test=23), Q(test=42)]
>>> # Here we use reduce()
>>> print Test.objects.filter(reduce(operator.or_, lookups))
[<Test test=1>, <Test test=2>, <Test test=23>, <Test test=42>]

This also works for operator.and_.

 

5000 days, the world wide web

Sep 16, 2008 11:54:00 PM

Kevin Kelly shares a fun stat: The World Wide Web, as we know it, is only 5,000 days old. Now, Kelly asks, how can we predict what's coming in the next 5,000 days?

Click here to watch the video.

 

Feeling twisted?

Sep 13, 2008 2:27:00 AM

Try playing Twister, the only thing you need is a browser and a colorprinter with 32 sheets of paper. Print the Twister dots and reorder them any way you like. You can cover the sheets with a piece of plastic to prevent them from damaging.

Have fun playing!

 

Django 1.0 released

Sep 4, 2008 10:46:00 AM

It has been a bumpy ride, and it has taken some time to get there, but the Django 1.0 version has been finally released!

Read on..., 1 comment.

 

Valencia bonita

Sep 2, 2008 9:04:00 PM

This weekend I went to Valencia with my NextGear collegues, and it was awesome!

Thursday evening I went to VeXocide in Dommelen, unfortunately my tram broke down, so I arrived quite early… arriving there I got lost a bit, but there was a very friendly lady that offered me a ride on the back of her bike, and she drove me to VeXocide’s house.

Oh man, getting up so early to catch the flight, all dazzled and still half sleeping I went for a bus-ride to Eindhoven station where all my colleagues had agreed to meet. One of my colleagues had to go for a quick stop at the local pharmacy to buy hand cream shouting “Quick, this is an emergency, I need hand cream now!” .. The girl behind the counter did have either a bad day, or people in Eindhoven have no sense of humor :)

Read on..., 2 comments.

 

Visitors

Locations of visitors to this page