Managing Context Metadata in Django-PGHistory: Solving the Persistence Problem
In this post you would learn how pghistory.context
works and some of its gotchas that we faced at Diversio(thanks to Amal Raj B R who identified this) and how we adjusted our approach to avoid saving context metadata that is not relevant to the current business logic but is being carried over from a parent context.
What is pghistory.context
?
pghistory.context
is a decorator and a function that is part of the fantastic django-pghistory
project. I would cover how we use django-pghistory
in a separate post.
When django-pghistory
is keeping track of changes to Django models, there are several instances where we want to include additional information with the tracked changes. This is where pghistory.context
comes into picture to easily capture such metadata …