Questions tagged [django-simple-history]

The django-simple-history app stores Django model state on every create/update/delete.

The django-simple-history app stores Django model state on every create/update/delete. A historical model is used to store changes for each tracked model and a custom admin interface is available for tracking historical changes.

109 questions
17
votes
1 answer

Use prefetch_related in django_simple_history

I have a model Booking which has a history in it. like this and I use django_simple_history class Booking(CreatedAtAbstractBase): history = HistoricalRecords() And I use a management command to do tasks. In that I wanted to Prefetch history…
Deepakraj Murugesan
  • 1,195
  • 11
  • 30
8
votes
6 answers

django-simple-history, displaying changed fields in admin

When I inherit from admin.ModelAdmin, in history on admin page I can see what fields has been changed. However, now I need to use django-simple-history to track all my model changes. Now, for admin, I inherit for simple_history.SimpleHistoryAdmin.…
Anil Panda
  • 375
  • 1
  • 3
  • 14
8
votes
4 answers

How to revert changes, specifically deletions, with django-simple-history

We have django-simple-history set up for our models. Recently a whole bunch of models were mysteriously deleted. This was noticed a few days after the fact, so it would be nice to avoid a full DB backup restore since that would wipe manual changes…
zaknotzach
  • 977
  • 1
  • 9
  • 18
7
votes
3 answers

Remove history button from Django admin

I want to enable/disable history from django admin button based on the type of user. My end goal here is to be able to understand how to show hide this button.
ofnowhere
  • 1,114
  • 2
  • 16
  • 40
7
votes
4 answers

Getting rest history from Django simple History

I am using django-simple-history (1.8.1) and DRF (3.5.3). I want to get a rest service containing the history of each element. Let's take an example ! models.py class Product(models.Model): name = models.CharField(max_length=50) price =…
cedrik
  • 541
  • 7
  • 17
6
votes
1 answer

django simple-history in admin

I would like to add admin view capability to django simple-history. I created a history attribute on a model and this model now appears in the admin docs section automatically without any further code from me, but it does not appear in the admin…
user773328
  • 323
  • 5
  • 11
5
votes
1 answer

Write migration changes to django simple history

django-simple-history writing history changes on instance.save() method. But when I wrote migration which change instance data, the changes did not appear. Is the save() method of Model = apps.get_model('myapp', 'MyModel') and MyModel are…
Max
  • 1,634
  • 1
  • 19
  • 36
5
votes
2 answers

django simple history - using model methods?

I'm using django-simple-history: http://django-simple-history.readthedocs.io/en/latest/ I have a model, which I would like to apply its methods on an historical instance. Example: from simple_history.models import HistoricalRecords class…
user3599803
  • 6,435
  • 17
  • 69
  • 130
4
votes
2 answers

django-simple-history populate history when existing history present

After setting up history for a model using django-simple-history, I wanted to run populate_history to populate the history table based on the existing contents of the table. However, other users have already made a number of changes, causing the…
beldaz
  • 4,299
  • 3
  • 43
  • 63
4
votes
3 answers

How can I store history of ManyToManyField using django-simple-history.

How can I store history of ManyToManyField using django-simple-history. I used HistoricalRecords with attribute m2m_filds but it is throwing error: unexpected keyword argument 'm2m_fields'
3
votes
2 answers

Django trigger post_save on update()

So I am using django-simple-history module that tracks changes in Model instances. However, it uses post_save signal to do so. In my project, I also need it to trigger on update(). My question is: How to overwrite the update() method to trigger…
3
votes
2 answers

How to track changes when using update() in Django models

I'm trying to keep track of the changes whenever a field is changed. I can see the changes in Django Admin History whenever I use the .save() method, but whenever I use the .update() method it does not record whatever I changed in my object. I want…
renno
  • 2,659
  • 2
  • 27
  • 58
2
votes
1 answer

How to get the user that modified an object? django-simple-history

I am trying to save the history of an object by using django-simply-history library, so far i can see the changes of the object itself but not the user that made the changes. I have the following set up. Settings: # settings.py INSTALLED_APPS = [ …
Jorge
  • 105
  • 9
2
votes
1 answer

Serializing Django simple history items the same way as the main model

I am trying to work with Django rest framework in conjunction with Django simple history. This answer has gotten me pretty far with understanding how to serialize the history items of a model. This works well for simple cases, but my model has a…
cts
  • 1,790
  • 1
  • 13
  • 27
2
votes
0 answers

Django simple-history how to track ForeignKey relations?

I am using django-simple-history to track changes to some fields on my models. My simplified model setup: class Collection(models.Model): description = models.TextField() # ... history = simple_history.HistoricalRecords() class…
Blub
  • 3,762
  • 1
  • 13
  • 24
1
2 3 4 5 6 7 8