Fix handling of IntegrityError in get_or_create for Django version 1.6+.