Django1.7 compatibility

Small fix for missing exception and alterations to the tests for Django 1.7 compatibility.