Commit 951eed81 authored by Michal Čihař's avatar Michal Čihař

Factor out filtering of child repos

parent 91ea1864
......@@ -458,6 +458,12 @@ class SubProject(models.Model):
messages.error(request, _('Failed to push to remote branch on %s.') % self.__unicode__())
return False
def get_linked_childs(self):
'''
Returns list of subprojects which link repository to us.
'''
return SubProject.objects.filter(repo = 'weblate://%s/%s' % (self.project.slug, self.slug))
def commit_pending(self):
'''
Checks whether there is any translation which needs commit.
......@@ -469,7 +475,7 @@ class SubProject(models.Model):
translation.commit_pending()
# Process linked projects
for sp in SubProject.objects.filter(repo = 'weblate://%s/%s' % (self.project.slug, self.slug)):
for sp in self.get_linked_childs():
for translation in sp.translation_set.all():
translation.commit_pending()
......
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