Django 1.6 improvements

Some compatibility fixes for Django 1.6