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

Add method for last change date

parent d05c6dc3
......@@ -612,12 +612,25 @@ class Translation(models.Model):
self.save()
def get_last_author(self):
'''
Returns last autor of change done in Weblate.
'''
try:
change = Change.objects.filter(unit__translation = self).order_by('-timestamp')[0]
return self.get_author_name(change.user)
except IndexError:
return None
def get_last_change(self):
'''
Returns date of last change done in Weblate.
'''
try:
change = Change.objects.filter(unit__translation = self).order_by('-timestamp')[0]
return change.timestamp
except IndexError:
return None
def commit_pending(self, author = None):
last = self.get_last_author()
if author == last or last is None:
......
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