summaryrefslogtreecommitdiff
path: root/scripts/restore_find_data.py
blob: 09064716214881af1780e4b78b432ae80d31cd08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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():
    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()