wuttjamaican.diffs¶
Tools for displaying simple data diffs
- class wuttjamaican.diffs.Diff(config, old_data: dict, new_data: dict, fields: list = None, nature='update', old_color='#ffebe9', new_color='#dafbe1', cell_padding=None)[source]¶
Represent / display a basic “diff” between two data records.
You must provide both the “old” and “new” data records, when constructing an instance of this class. Then call
render_html()to display the diff table.- Parameters:
config – The app config object.
old_data – Dict of “old” data record.
new_data – Dict of “new” data record.
fields – Optional list of field names. If not specified, will be derived from the data records.
nature – What sort of diff is being represented; must be one of:
("create", "update", "delete")old_color – Background color to display for “old/deleted” field data, when applicable.
new_color – Background color to display for “new/created” field data, when applicable.
cell_padding – Optional override for cell padding style.