Commit 09cd24df authored by Michal Čihař's avatar Michal Čihař

Factor out translation propagation

parent e4232c54
......@@ -1466,6 +1466,16 @@ class Unit(models.Model):
return ret
def propagate(self):
'''
Propagates current translation to all others.
'''
allunits = Unit.objects.same(self).exclude(id = self.id)
for unit in allunits:
unit.target = self.target
unit.fuzzy = self.fuzzy
unit.save_backend(request, False)
def save_backend(self, request, propagate = True, gen_change = True):
'''
Stores unit to backend.
......@@ -1529,11 +1539,7 @@ class Unit(models.Model):
# Propagate to other projects
if propagate:
allunits = Unit.objects.same(self).exclude(id = self.id)
for unit in allunits:
unit.target = self.target
unit.fuzzy = self.fuzzy
unit.save_backend(request, False)
self.propagate()
def save(self, *args, **kwargs):
'''
......
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