use return getattr(self.data, 'show_total', True) istead all of this block