Comments (4)
Thanks for submitting this issue @IliynT. This looks like a bug. At first I thought this might be related to #59, but they look like different issues.
We have a test for save_without_historical_record
and it seems to work.
A broken test would be ideal for figuring out how to troubleshoot and fix this issue. If you want to try tackling that, see instructions for running the tests here.
Alternatively if you narrow down the issue enough that you're willing to share a whole project that doesn't work someone might be able to devise a test from the broken project and a subsequent fix.
from django-simple-history.
On further inspection it looks like the code example you gave would cause infinite recursion.
save_without_historical_record
actually calls save.
The correct way to save without a historical record from the save
function is to mimick the save_without_historical_record
code and temporarily set skip_history_when_saving
to True
.
from django-simple-history.
@IliynT did you ever overcome this issue? I'm still not sure whether the problem you were experiencing was due to a bug in django-simple-history.
from django-simple-history.
Using save_without_historical_record
directly in the save
method is not currently supported.
If there is call for a feature like this, maybe we should consider save_with_historical_record()
as well, and add a flag such as 'auto_track_saves' to the HistoricalRecords
class __init__
method?
from django-simple-history.
Related Issues (20)
- 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
- Add optimized update_or_create Manager method
- HistoricForeignKey is very slow HOT 2
- Release current main branch to PyPi HOT 1
- Remove the "not created" condition from post_save when skipping history creation HOT 1
- m2m historical records are saved even when SIMPLE_HISTORY_ENABLED = False
- skip_history_when_saving if model has no any changes HOT 3
- Sending create_historical_record() to celery tasks HOT 8
- Integration with admin.Models failing
- Not null constraint fails with inheritance and m2m fields
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.