I was wondering what would be the best way to create dynamic report documents (html) with Django. The data used for every report is stored in model instances which then gets passed to a html template which renders the report. The user should be able to edit all the rendered content via a front-end editor.
Is it possible to use flat pages to store a complete document in html per report instance? Looking at the documentation it seems as if the flatpages app is mainly used for global static pages which can be edited via admintools. Is it possible to set up one Flatpage instance for each report instance in the system (e.g. Model Report with a Flatpage foreign key)?
take a look at the flatpage model. It has a textfield for its content.
https://github.com/django/django/blob/master/django/contrib/flatpages/models.py
In your code, you can store any content and store it in the textfield. ( I will store it as json string )
Then in your template, you can parse that string into json and use it.
Depending on your front end editor, you should can always parse the data into a json and store it back into flatpage model using via a post request and handled with a custom view with logics to convert your return json data and store it in the content field in your flatpage model. ( You will need to use json.dumps to convert your json object into string )
Let me know if you need a more specific example.