changed error message handling to use django messages framework