Comments (3)
Thanks for reporting this @BeccaMG!
I'm aware of this issue but it looks like it never made it into the issue tracker. Let's use this ticket to start the discussion about history on fixture-loaded data.
The test_raw_save test demonstrates this bug. Fixtures send a raw=True
and django-simple-history does not save historical data for raw saves. It looks like this was disabled in 0fd9b8e.
I'm not sure what the downsides might be to forcing historical model creation on raw saves. Maybe we should look into this (try it out and see what tests fail, research raw
and possible downsides to recording history when raw=True
, etc.).
A process for manually creating historical records for existing data (like #60) may provide a workaround for this problem (since historical records could be created after fixtures are loaded).
from django-simple-history.
First: Fixtures are pretty useful, but a solution like Factory Boy or Model Mommy may be more useful, especially in the long run.
As @treyhunner mentioned, there is now a populate_history
command that will allow you to create historical versions of existing model instances. It appears to be undocumented though.
Personally, I'm against populating when raw=True
. It looks like the idea behind that flag is to have the fixture data load directly into the database without side effects. If you wish the historical data to load as well, you could add fixtures for the historical models, correct? I could be speaking out of ignorance though, because I have not used the fixture features in Django.
from django-simple-history.
Closing... I believe #153 is a related issue. We should probably add some documentation about migration and fixture cases.
from django-simple-history.
Related Issues (20)
- History for ManyToMany tables not being tracked HOT 4
- Add some clue from where in the code the update came from
- Instruction to install django-simple-history before exectuing runtests.py is missing
- Error with identifiers with '/' HOT 1
- Helper to merge / append to history records
- date_hierarchy with history_date
- Unique fields in django model translation with Simple History HOT 5
- Inappropriate verbiage in the signals documentation HOT 1
- Utils documentation missing for populate_history management command
- SimpleHistoryAdmin.history_view always use `AUTH_USER_MODEL` for generating the URL under "Changed By"
- `diff_against` does not detect changes on deletion history type
- Show diff in history_view
- as_of with Postgres generates a Sequential Scan with composite index enabled HOT 5
- Changing many-to-many field creates additional HistoricalRecord HOT 3
- Access foreign key of historic instance from model methods HOT 1
- [Question] How to prevent history from being created for a new object? Also how to set user to history after it has been created? HOT 2
- Updating M2M relations causes unnecessary DB queries HOT 11
- How to annotate the historical model to the QuerySet HOT 3
- not working abstract model HOT 1
- "update_fields" option to "bulk_create" not supported? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-simple-history.