updating for compatibility with both Django 1.3 as well as 1.6