
So what do you do if you require a django setting in your templates, much like we have MEDIA_URL today?
Well there are use cases for this, (if you are in doubt have a look at the original ticket for adding MEDIA_URL to django ).
The easiest way that I have found so far is to write a context processor. For example in my settings I might have JAVASCRIPT_URL (which in my real life code changes depending on whether I am running in debug, test or from a CDN):
JAVASCRIPT_URL = 'http://myjshost.com'
Now from here I would like to make this available in my templates. Create a new python file that is somewhere on your python path (Under my project, I create a utils directory and then put a file context_processors.py in there. Don’t forget __init__.py should live in that directory as well).
In the context_processors.py file simply put
def javascript_url(request):
from django.conf import settings
return {'JAVASCRIPT_URL': settings.JAVASCRIPT_URL}
In your settings.py file you might already have a reference to TEMPLATE_CONTEXT_PROCESSORS if not then add it like so:
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
TEMPLATE_CONTEXT_PROCESSORS += (
'django.core.context_processors.request',
'django.core.context_processors.i18n',
'appname.utils.context_processors.javascript_url',
)
And thats about it. From there on in you will be able to use JAVASCRIPT_URL like MEDIA_URL:
Posted on January 22nd, 2010 by timc3 in Computing, django | Add your Comments »

Oh this is clever:
The White Balance Lens Cap: “

You may think automatic white balance is good enough. But if you’ve ever had to fix dozens (or even 100s) of photos with just slightly different colors, one-by-one, you know the true meaning of pain. The White Balance Lens Cap leaves you no excuse for not properly white-balancing every situation you encounter. Simply flip your camera into custom White Balance mode, snap a photo with your White Balance Lens Cap on, and your camera creates a perfect profile of the actual lighting in front of you. Best of all, unlike a gray card, the White Balance Cap takes no extra room in your gear bag. Just replace your existing lens cap with this one and you’ll always be able to white balance with no additional equipment.
”
(Via swissmiss.)
Posted on January 22nd, 2010 by timc3 in Tech reading | Add your Comments »

Awesome silicon based material for hacking anything – http://sugru.com/
Posted on January 20th, 2010 by timc3 in Me | Add your Comments »

Posted on January 12th, 2010 by timc3 in Computing | Add your Comments »

I have just spent the past 90 minutes updating contact details – much longer than it should take. Would be nice if I could just update say on Plaxo, and linkedin, Facebook etc would receive the updates but I guess we haven’t got to that stage yet. Have also sent out emails to lots of people, so apologies if you haven’t received one.
The main change is my mobile number – it belonged to vizrt, with whom my last day was officially the 31st of December. So please remove that from your records, I am waiting for company registration details to go through before I get a proper new mobile number but in the meantime reach me at tim@ the usual places or skype me on timchild.
Just to reiterate – my mobile number is no more.
Posted on January 1st, 2010 by timc3 in Me, Sweden | Add your Comments »

It’s been another Christmas, and almost a full year.
Christmas was good this year – Mum and Dad came over and spent it in Sweden, a little bit of time in Stockholm but mostly in the country. I think they really enjoyed meeting Harriet for the first time. Harriet enjoyed meeting them too but I don’t think that she really noticed Christmas this year.
She got lots of nice things to make her life cosy, her teddy bear and soft toy collection is growing almost as fast as her clothing collection is.
I seemed to spend most of the time cooking, this year was Beef and Moose Wellington. I would say it suits Beef better but it was good to try anyways.
So now its just some time before new year.

Posted on December 28th, 2009 by timc3 in Baby, Me, Sweden | Add your Comments »

LEGO CD Boombox: “

This looks awesome.
(Via swissmiss.)
Posted on December 9th, 2009 by timc3 in Me | Add your Comments »

Went in today to sign some documents and have an “interview” – so its official that I am now a father. Was quite sure that I was at least a month ago also, but thanks mother Sweden for making it available in the public records.
Baby is doing fine, me as well I think.
Posted on November 23rd, 2009 by timc3 in Baby | Add your Comments »

Been making a lot of tarts recently for some reason.. Perhaps because they taste some damn good.
Today was a Italian spinach and ham tart that was quite like the recipe used in one of Jamie Oliver’s books, it was good but not as good as the Courgette tart (or Zucchini tart) I cooked the other day.
Others have been Goat Cheese and Leek and a Spinach and Blue Cheese tart. Next up is a Red Pepper one I think.
I think it is something to do with being a father, wanting to provide food is probably one of those fundamental instincts, though I must admit I like the eating myself. Christmas is just around the corner so I could do with the cooking practise.
Some day I will put the recipe up at fork full or somewhere.
Posted on November 5th, 2009 by timc3 in Cooking | Add your Comments »

Kristin continues to feed the baby and I feed her, so I have been doing a lot of cooking recently such as:
- Goat Cheese and Leek Tart, for today.
- Brownies – These are more of a desert brownie, great with icing sugar and a little cream.
- Roasted White fish with leek – A classic kind of Jamie Oliver dish, I used cod.
- Potato supper, a simple dish of Bacon, Potatoes, Onions to which I added a good quality Italian sausage. The idea came from Nigel Slater’s book Appetite
- Spinach and Blue cheese tart. Next time I will use the recipe from here I think.
- Chicken chow mein – not up to the standard of a really good chinese, or the rest of the food here but still perfectly nice.
Next up is chicken cacciatore and a sausage dish that I saw being cooked on one of Nigel Slater’s programmes – with roasted onions and bell peppers. Awesome.
Posted on October 30th, 2009 by timc3 in Food | Add your Comments »