compatibility fixes for Django 1.6

Another set of fixes witch are reaction to recent changes in Django 1.6 code.