chartit/django-chartit

Support for RawQuerySet

someidiot opened this issue · 3 comments

Is this possible? Sometimes the ORM just can't do what I need and a raw query is the easiest way to go.

@someidiot I will have to look a bit more into the code to verify whether or not this is possible but the straight out answer is no. chartit is very tightly coupled to QuerySet and it's API. It does use said API for validation and field lookups. This is making it very hard to add functionality that doesn't conform to QuerySet. Right now I'm thinking about refactoring quite a few pieces of the code to allow for more flexibility but haven't had the time to do so in the last month.

Let me get back to you on the RawQuerySet support in a week or so, it may turn out less trickier than I think.

Thanks. It's no biggie, just trying to avoid having two different charting methods in my code, it would be nice to use this for everything.

@someidiot I have good news for you. I've managed to get a working support for RawQuerySet for Chart type of charts. Haven't looked into PivotChart yet, bout should be similar. The main change was that I needed to get rid of QuerySet.values() internally and make use of objects instead of dictionaries. However this is something I've been wanting to do for a while now.

Can you checkout my fork + topic branch, give it a try and let me know how that works for you? Also see the demoproject/ for some usage examples. I'm planning to release to PyPI very soon if this works for you.