chartit / django-chartit

A Django app to plot charts and pivot charts directly from the models. Uses HighCharts and jQuery JavaScript libraries to render the charts on the webpage.
http://django-chartit.mrsenko.com/
Other
492 stars 166 forks source link

Cannot subclass Chart #41

Closed someidiot closed 8 years ago

someidiot commented 8 years ago

I get stack overflow when trying to extend the Chart class due to the way the superclass is called in Chart.init. Using self.class causes problems, see http://stackoverflow.com/questions/18208683/when-calling-super-in-a-derived-class-can-i-pass-in-self-class

atodorov commented 8 years ago

@someidiot - this is an easy fix but can you post a reproducer so I can make a test for this.

The SO thread sounds about right but I've had the habit of using self.__class__ for quite a long time and haven't seen such problems. It bugs me I may have been doing it wrong the whole time and I want to investigate in details. Thanks.

atodorov commented 8 years ago

FYI I have also sent a PR to pylint for this error. It looks like they also had a regression in detecting super(type(self)) but that's another story, see https://github.com/PyCQA/pylint/pull/1109

someidiot commented 7 years ago

Awesome, thanks