grantmcconnaughey/django-field-history

Temporarily disabling field tracking

Opened this issue · 1 comments

Is there any way we can temporarily disable tracking either by disconnecting signals or using some magic settings?
Example reason for doing this would be to pull historical data (timestamp, value) from already existing source. I'm not sure this is possible at this point..

@grantmcconnaughey I'll be glad to make PR + docs, after we figure out the way to handle this.
Thanks!

Hey there, @mariodev. There is not a way to do this currently. Perhaps we could make a decorator or context manager that temporarily disabled setting the field history. Something like...

@disable_field_history
def import_historical_data():
    pass

Or...

with disable_field_history():
    import_historical_data()

I prefer the second option. Not sure how we would implement those exactly... I wouldn't want them to affect field history being saved in other threads.

What do you think?