Commit 9210d92a authored by Michal Čihař's avatar Michal Čihař

Differentiate new translation from change (issue #166)

parent 1ee8b53a
...@@ -435,6 +435,6 @@ class ChangeManager(models.Manager): ...@@ -435,6 +435,6 @@ class ChangeManager(models.Manager):
''' '''
from weblate.trans.models import Change from weblate.trans.models import Change
return self.filter( return self.filter(
action=Change.ACTION_CHANGE, action__in=(Change.ACTION_CHANGE, Change.ACTION_NEW),
user__isnull=False, user__isnull=False,
) )
...@@ -2371,11 +2371,15 @@ class Unit(models.Model): ...@@ -2371,11 +2371,15 @@ class Unit(models.Model):
# Generate Change object for this change # Generate Change object for this change
if gen_change: if gen_change:
if oldunit.translated:
action = Change.ACTION_CHANGE
else:
action = Change.ACTION_NEW
# Create change object # Create change object
Change.objects.create( Change.objects.create(
unit=self, unit=self,
translation=self.translation, translation=self.translation,
action=Change.ACTION_CHANGE, action=action,
user=request.user user=request.user
) )
...@@ -2760,11 +2764,13 @@ class Change(models.Model): ...@@ -2760,11 +2764,13 @@ class Change(models.Model):
ACTION_CHANGE = 2 ACTION_CHANGE = 2
ACTION_COMMENT = 3 ACTION_COMMENT = 3
ACTION_SUGGESTION = 4 ACTION_SUGGESTION = 4
ACTION_NEW = 5
ACTION_CHOICES = ( ACTION_CHOICES = (
(ACTION_UPDATE, ugettext_lazy('Resource update')), (ACTION_UPDATE, ugettext_lazy('Resource update')),
(ACTION_COMPLETE, ugettext_lazy('Translation completed')), (ACTION_COMPLETE, ugettext_lazy('Translation completed')),
(ACTION_CHANGE, ugettext_lazy('Translation changed')), (ACTION_CHANGE, ugettext_lazy('Translation changed')),
(ACTION_NEW, ugettext_lazy('New translation')),
(ACTION_COMMENT, ugettext_lazy('Comment added')), (ACTION_COMMENT, ugettext_lazy('Comment added')),
(ACTION_SUGGESTION, ugettext_lazy('Suggestion added')), (ACTION_SUGGESTION, ugettext_lazy('Suggestion added')),
) )
......
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