July 2008
September 2008
August 2008
August 12, 2008 08:30.38 PM
If you're using Django out there and you happen to use the extra_context variable for your generic templates, you might have noticed that the querysets are being cached and not updated unless you restart your server. The problem is that querysets will be cached by definition of the extra_context dictionary unless they are callable functions. See the example below as it applies to my sidebar.
def get_books():
return Book.objects.filter(status='S').order_by('-post_date')[:3]
def get_albums():
return Album.objects.filter(status='S').order_by('-post_date')[:3]
def get_dvds():
return DVD.objects.filter(status='S').order_by('-post_date')[:3]
def get_blogrolls():
return BlogRoll.objects.order_by('-last_name')
info_dict = {
'queryset': Post.objects.filter(status='P').order_by("-pub_date"),
'date_field': 'pub_date',
'extra_context':{ 'books' : get_books,
'albums' : get_albums,
'dvds' : get_dvds,
'blogrolls' : get_blogrolls,
'form':form,
},
}
2 Comments
August 08, 2008 08:00.57 AM
I made the picture of that homeless guy using Apple's little bulls eye feature because I was lazy when editing the original. Because it made it a PNG, it was way too large. Of course, I didn't notice and the page loaded pretty slowly in Google Reader. I opened up GIMP and made it a lower quality JPG. It looks the same but most importantly, is 1/6 the size.
0 Comments
August 07, 2008 01:41.00 PM
So I was casually looking out of my hotel room window and from eleven stories high, I noticed quite the site. I wasn't sure if I was having some perception problems or if I was truly seeing what I thought I saw. I observed for a few minutes and came to the conclusion that it was exactly what I thought it was. So, to catch the moment, I tore apart my luggage looking for my camera. When I finally found it, I missed the best moments but I still caught enough evidence for my story.
Please note his pants at his ankles and the cup in his right hand. Yes folks, this guy was dancing in front of Toronto's town hall with his pants at his ankles trying to get money from pedestrians going to work. This was at 7:30AM so he was having quite an early start. Unfortunately, I was late to the first conference session so I didn't have time to run downstairs and get a closer look.
0 Comments