Incorporated some of the changes from django 1.4.2 default templates