Fix for Django 1.7

This is a fix for issue #493.