summaryrefslogtreecommitdiff
path: root/todolists
diff options
context:
space:
mode:
Diffstat (limited to 'todolists')
-rw-r--r--todolists/views.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/todolists/views.py b/todolists/views.py
index 127fd8b8..52987356 100644
--- a/todolists/views.py
+++ b/todolists/views.py
@@ -23,12 +23,11 @@ class TodoListForm(forms.Form):
widget=forms.Textarea(attrs={'rows': '20', 'cols': '60'}))
def clean_packages(self):
- packages = []
- for p in self.clean_data['packages'].split("\n"):
- for pkg in Package.objects.filter(
- pkgname=p.strip()).order_by('arch').distinct():
- packages .append(pkg)
-
+ package_names = [s.strip() for s in
+ self.clean_data['packages'].split("\n")]
+ package_names = set(package_names)
+ packages = Package.objects.filter(
+ pkgname__in=package_names).order_by('arch')
return packages