Pages

Monday, February 16, 2009

Post-it Notes make a fickle mistress.

Monday, June 2, 2008

Amazingly useful useless things we've taught the toddler

This week, we taught the kiddo how to "zerbert" someone's belly. This is also called "rasberries". Regardless of what you call it, we call it fun.

We also taught him how to "zerbert" his hands. This is very similar to making "fart noises", but what responsible parent would teach such a thing. Tacky. And crass.

Lastly, we long ago taught him how to use lotion, and he has been very fond of lotioning both his belly and his arms.

Now we have taught him the joy of lotioning other people. It's as if spas employed little woodland gnomes who emerge from their warm burroughs to gently rub lotion onto your drying skin.

Or maybe like the shoemaker and the elves, except its lotion. Or maybe it's like you're a giant piece of soft candy and an oompa-loompa moseys over to smear tasty icing on your legs.

It's kind of like all those things and really cool.

Wednesday, May 7, 2008

My new fav command:

python manage.py validate

Validate your models before you try and load them. So much less stressful for some reason.

Saturday, March 8, 2008

Kill a command in Unix (or on Solaris)

kill [pid]

Use prstat to find the [pid]

kill [pid] is the same as kill -9 [pid] which is a "soft kill". If that doesn't work, you can do kill 15 [pid] which kills it no matter what.

Friday, January 11, 2008

Monday, August 20, 2007

Defining more complex names with Django

The easiest way to define self for a Model:

def __str__(self):
  return self.name

Name is a field in the Model. self.name takes the value for 'name' and uses it as the default string representation for that row.

You can also user more complex strings to define self. In this example, 'country' is another ForeignKeyField column in the Model, and 'abbr_2' is a column in the Country model. Dot notation lets you travel across Models:

def __str__(self):
  return '%s, %s' % (self.name, self.country.abbr_2)

I think you can also uses custom managers to get even fancier, but I can't figure that out.

Monday, December 18, 2006

Basic filters work

Finally, all the filters work:


reviews = articles.filter(article_type__name__exact='review')


Not sure what the problem was. Today I'll learn how to commit.

Sunday, December 17, 2006

Allegedly figured out filtering

Allegedly figured filtering out using an IBM tutorial. Apparently, you have to specify the entire path across the object to the attribute using double underscores as separators (__). This wasn't entirely clear in the documentation.


news = articles.filter(article_type__name__exact='news')


Articles is a query set where I yanked all an artist's related articles. The filter works by looking at the object__attribute__filter you'd like to use.

Works for news, but it's not working for playlists...

Artist slugs working

I didn't have the regex guide on the train, so I didn't get the slugs working till tonight:


(r'^music/artists/(?P[-\w]+)/$', 'objecta_website.content_manager.views.artist_profile'),


I need to check-in, but I'm kind of waiting on getting the filters on M2M lookups working correctly. Bastards.