Creating generic log table for various Django models

0

I have 30 models. Each one contains information from a calculator and each record is information from sub calculators. I need to create a table of logs of each calculation made by the user.

Currently I'm saving JSON what the guy says and saving the result in JSON as well. Because each calculator has different fields and different results (some are lists, other variables and other dictionaries).

Is there a better way to do this? The problem I am facing is that if I want to get reports / metrics of all the data I would have to create a script to get and transform (from every calculation done per user). Thing that if I had saved everything in a model would be easier (with Django).

The problem is that I would then have to create + 30 models. Or I would have to create hundreds of fields that all calculators have and also fields with all possible results. It's a little confusing to imagine that.

Could anyone give me a hint at this scenario?

    
asked by anonymous 29.10.2018 / 16:18

1 answer

2

I recommend using the Django Activity Stream .

You can create logs dynamically, with specific information about actor , action and action target .

    
05.11.2018 / 21:05