Fix checks for Django versions earlier than 1.7

Sorry for recreating the PR, but hope this helps.