Updated to be Django 1.5 compatible.