The Runcible Blog

Saturday, February 25th, 2006

At the Liberry

I'm at one of the MIT libraries right now, using a very fast "dumb terminal" running Linux. Web browsing is wayy faster than on my Mac Mini, though I guess it helps to have a T3 or whatever. I almost want to get a speedy FreeBSD box just to use FireFox. But, I don't have the space...


Friday, February 24th, 2006

Now with Tags!

Death to Categories! Long live Tags!

I had been thinking of adding something like those new-fangled "tags" that every website seems to have these days because the current category paradigm seems too static. Well, I just implemented tags after some inspiration from Ross Poulton's post about tags with Django. I took it a step further and tried my hand at "multi-tags" like IMDB's keyword search. I don't think I'll spend too much time refining the tag selection, but it has potential...

For the interested, here's the function that I'm using to render pages when there are multiple tags in the url (the url regex captures any slug + / because I'm not smart enough with regular expressions to split the parts there). It uses a clever (maybe not) method of building Q objects to make a complex query. For one tag urls (like comedy, Django's generic views do the work.

def multitags(request,thetags): query = Q(published__exact=True) splittags = thetags.split('/') for t in splittags: # build a complex query query = query & Q(tags__slug__exact=t) try: entrylist = entries.get_list(complex=query) except entries.EntryDoesNotExist: raise Http404 else: # find the tags tagobjs = [tags.get_object(slug__exact=t) for t in splittags] return render_to_response('blog/tags_multi',{'tags':tagobjs, 'entries':entrylist, 'tagstring': ' '.join(splittags)})

Thursday, February 9th, 2006

Sly Lives?

Sly Stone is still alive?! For some reason, I had assumed that he died at a young age. The liner notes in the only Sly & The Family Stone album I have refer to Sly in the past tense. Not only was I shocked to hear (on the radio this morning) that Sly lives, but check out his blond mohawk! And he's 63 years old! Cool.