Add Travis support.
Fix for Django bug 21563 with Python 3 and hasttr.

In Python 3, hasattr() looks only for AttributeError rather than any
exception, and so the potential DoesNotExist is passed through.