Commit dc309ed7 authored by Michal Čihař's avatar Michal Čihař

Correct merging of multiple IndexUpdate objects

The object can already exist, so we need to update source flag if
needed.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 527fa89f
......@@ -156,7 +156,13 @@ def update_index_unit(unit, source=True):
# Should this happen in background?
if appsettings.OFFLOAD_INDEXING:
from weblate.trans.models.unitdata import IndexUpdate
IndexUpdate.objects.create(unit=unit, source=source)
update, created = IndexUpdate.objects.get_or_create(
defaults={'source': source},
unit=unit,
)
if created and not update.source and source:
update.source = True
update.save()
return
# Update source
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment