diff options
author | Dusty Phillips <buchuki@gmail.com> | 2008-06-27 21:15:34 -0400 |
---|---|---|
committer | Dusty Phillips <buchuki@gmail.com> | 2008-06-27 21:16:03 -0400 |
commit | 3d40da381cccfb1e1b74becb9076e816f76c6f02 (patch) | |
tree | 33fe2ae113214351c13cc31a6b7e1f2b51cfabbd /todolists/views.py | |
parent | 6b013d99fcfb596cbbdfb53fa03a07888dde1e9b (diff) |
refactor package cleaning to be duplicate sensitive
Diffstat (limited to 'todolists/views.py')
-rw-r--r-- | todolists/views.py | 11 |
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 |