From a1ba86dcf1e34151cae3af9b1515c6b9477269f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 28 Feb 2012 10:13:43 +0100 Subject: [PATCH] Cache whether entry is translated --- trans/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/trans/models.py b/trans/models.py index b3ca8355f..2ea2e00df 100644 --- a/trans/models.py +++ b/trans/models.py @@ -211,6 +211,7 @@ class Unit(models.Model): source = models.TextField() target = models.TextField(default = '', blank = True) fuzzy = models.BooleanField(default = False) + translated = models.BooleanField(default = False) objects = UnitManager() @@ -219,12 +220,14 @@ class Unit(models.Model): flags = '' # FIXME target = join_plural(unit.target.strings) fuzzy = unit.isfuzzy() - if not force and location == self.location and flags == self.flags and target == self.target and fuzzy == self.fuzzy: + translated = unit.istranslated() + if not force and location == self.location and flags == self.flags and target == self.target and fuzzy == self.fuzzy and translated == self.translated: return self.location = location self.flags = flags self.target = target self.fuzzy = fuzzy + self.translated = translated self.save(force_insert = force) def is_plural(self):