Commit 7827e982 authored by Michal Čihař's avatar Michal Čihař

Simplify condition

parent aaa64549
...@@ -143,6 +143,7 @@ class UnitManager(models.Manager): ...@@ -143,6 +143,7 @@ class UnitManager(models.Manager):
Basic filtering based on unit state or failed checks. Basic filtering based on unit state or failed checks.
''' '''
import trans.models import trans.models
import trans.checks
if rqtype == 'all': if rqtype == 'all':
return self.all() return self.all()
elif rqtype == 'fuzzy': elif rqtype == 'fuzzy':
...@@ -159,7 +160,7 @@ class UnitManager(models.Manager): ...@@ -159,7 +160,7 @@ class UnitManager(models.Manager):
project = sample.translation.subproject.project) project = sample.translation.subproject.project)
sugs = sugs.values_list('checksum', flat = True) sugs = sugs.values_list('checksum', flat = True)
return self.filter(checksum__in = sugs) return self.filter(checksum__in = sugs)
elif rqtype in [x[0] for x in trans.models.CHECK_CHOICES]: elif rqtype in trans.checks.CHECKS:
try: try:
sample = self.all()[0] sample = self.all()[0]
except IndexError: except IndexError:
......
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