Move data pre-template processing to the charts apps, code cleanup, PEP8 cleanups