diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-10-29 23:14:22 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-10-29 23:14:22 +0100 |
commit | 029b74dfa13919222138734b41265642e30494ab (patch) | |
tree | 7702a5f61b7295f20c8690ed51bb0bc9b63d2e9f /scripts/restore_find_data.py | |
parent | ed56b61fb8cc09467175d8fb97ec6a8d459e92e7 (diff) | |
download | Ishtar-029b74dfa13919222138734b41265642e30494ab.tar.bz2 Ishtar-029b74dfa13919222138734b41265642e30494ab.zip |
Add update_data util to overload data dict properly
Diffstat (limited to 'scripts/restore_find_data.py')
-rw-r--r-- | scripts/restore_find_data.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/restore_find_data.py b/scripts/restore_find_data.py new file mode 100644 index 000000000..3dbbc4518 --- /dev/null +++ b/scripts/restore_find_data.py @@ -0,0 +1,19 @@ +""" +Restore find data on destructive import +""" + +from ishtar_common.utils import update_data + +from archaeological_finds.models import Find + + +for item in Find.objects.all()[0:50]: + data = item.data + for h in item.history.order_by('-history_modifier_id', '-history_date', + '-history_id').all(): + data = update_data(data, h.data) + item.data = data + item.skip_history_when_saving = True + item.save() + + |