grantmcconnaughey / django-field-history

A Django app to track changes to model fields.
BSD 3-Clause "New" or "Revised" License
314 stars 33 forks source link

Temporarily disabling field tracking #14

Open mariodev opened 8 years ago

mariodev commented 8 years ago

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!

grantmcconnaughey commented 8 years ago

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?