O'Reilly logo

Django 1.1 Testing and Debugging by Karen M. Tracey

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Fixing the pygooglechart results display

We seem close to having a working implementation of pie charts for our results display. We can update the get_piechart_url method to look like this:

    def get_piechart_url(self): 
        import pdb; pdb.set_trace() 
        answer_set = self.answer_set.all() 
        chart = PieChart3D(500, 230) 
        chart.add_data([a.votes for a in answer_set]) 
        chart.set_legend([a.answer for a in answer_set]) 
        return chart.get_url() 

The changes from the previous version are first removal of the logging calls (since they weren't particularly helpful) and also removal of the import of logging. The import for PieChart3D has been moved to the top of the file, with the other imports. The erroneous call to chart.set_data has been replaced with the correct

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required