diff options
author | eliott <eliott@cactuswax.net> | 2008-04-17 19:44:26 -0700 |
---|---|---|
committer | eliott <eliott@cactuswax.net> | 2008-04-17 19:44:26 -0700 |
commit | 3d9c71dc0a5eeafcdd323cb1cbe06ff77d7c2d54 (patch) | |
tree | 5f3b85f2f3d9c5897b98bddc3cf505b5501b3583 /main | |
parent | dc6f471349d090245d7a1641e830bcb95a14e026 (diff) |
added more clarity to required_by fields
Diffstat (limited to 'main')
-rw-r--r-- | main/models.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/main/models.py b/main/models.py index d4250f3d..fb548e96 100644 --- a/main/models.py +++ b/main/models.py @@ -194,20 +194,17 @@ class Package(models.Model): def get_requiredby(self): """ - Returns a list of tuples(2). - - Each tuple in the list is as follows: (packageid, packagename) + Returns a list of package objects. """ reqs = [] requiredby = PackageDepend.objects.filter(depname=self.pkgname).filter( - Q(pkg__arch=self.arch) | Q(pkg__arch__name__iexact='any') - ).order_by('depname') + Q(pkg__arch=self.arch) | Q(pkg__arch__name__iexact='any')) for req in requiredby: - reqs.append((req.pkg.id,req.pkg.pkgname)) + reqs.append(req.pkg) ## sort the resultant list. Django has problems in the orm with ## trying to shoehorn the sorting into the reverse foreign key ## reference in the query above. :( - reqs.sort(lambda a,b: cmp(a[1],b[1])) + reqs.sort(lambda a,b: cmp(a.pkgname,b.pkgname)) return reqs def get_depends(self): |