My new fav command:
python manage.py validate
Validate your models before you try and load them. So much less stressful for some reason.
Wednesday, May 7, 2008
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
List running proccesses
prstat -Z
Lists all running processes on the shared accelerator.
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:
Not sure what the problem was. Today I'll learn how to commit.
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.
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...
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:
I need to check-in, but I'm kind of waiting on getting the filters on M2M lookups working correctly. Bastards.
(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.
Subscribe to:
Posts (Atom)