prepare_results should be able to return extra data apart from aaData to get_context_data
Issue #19
invalid
My use case is that I would like to calculate subtotals for one of the columns I return from prepare_results. My understanding is that I can do so by appending a value to the dictionary that is returned to the JavaScript code, but prepare_results does not have access to it, so it seems to be impossible right now.
Comments (3)
-
repo owner -
reporter Thank you Maciej, you are right, I should have looked at the code better. I've done:
def get_context_data(self, *args, **kwargs): r = super(BaseDatatableView, self).get_context_data(*args, **kwargs) r['total'] = self.total return r
... and I've assigned
self.total
inprepare_results
. -
reporter - changed status to invalid
- Log in to comment
I don't fully understand the issue there. If you want to append a dictionary to final data dictionary returned from the view then you can just override get_context_data method.