summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/models.py11
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):