summaryrefslogtreecommitdiffstats
path: root/todolists
diff options
context:
space:
mode:
authorDusty Phillips <buchuki@gmail.com>2008-06-28 03:15:34 +0200
committerDusty Phillips <buchuki@gmail.com>2008-06-28 03:16:03 +0200
commit3d40da381cccfb1e1b74becb9076e816f76c6f02 (patch)
tree33fe2ae113214351c13cc31a6b7e1f2b51cfabbd /todolists
parent6b013d99fcfb596cbbdfb53fa03a07888dde1e9b (diff)
downloadarchweb-3d40da381cccfb1e1b74becb9076e816f76c6f02.tar.gz
archweb-3d40da381cccfb1e1b74becb9076e816f76c6f02.tar.xz
refactor package cleaning to be duplicate sensitive
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 127fd8b..5298735 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