feat(access): Save changes to history for organization and teams

!9 closes #5
This commit is contained in:
2024-05-23 14:07:36 +09:30
parent f7444892d0
commit 724c52b777
8 changed files with 137 additions and 13 deletions

View File

@ -138,3 +138,29 @@ your content here
{% endblock %}
```
## Add history to model
The tracking of changes can be added to a model by including the `SaveHistory` mixin from `core.mixin.history_save` to the model.
``` python
from core.mixin.history_save import SaveHistory
class MyModel(SaveHistory):
.....
```
for items that have a parent item, modification will need to be made to the mixin by adding the relevant check and setting the relevant keys.
``` python
if self._meta.model_name == 'deviceoperatingsystem':
item_parent_pk = self.device.pk
item_parent_class = self.device._meta.model_name
```