summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authoreliott <eliott@cactuswax.net>2008-04-18 04:44:26 +0200
committereliott <eliott@cactuswax.net>2008-04-18 04:44:26 +0200
commit3d9c71dc0a5eeafcdd323cb1cbe06ff77d7c2d54 (patch)
tree5f3b85f2f3d9c5897b98bddc3cf505b5501b3583 /main
parentdc6f471349d090245d7a1641e830bcb95a14e026 (diff)
downloadarchweb-3d9c71dc0a5eeafcdd323cb1cbe06ff77d7c2d54.tar.gz
archweb-3d9c71dc0a5eeafcdd323cb1cbe06ff77d7c2d54.tar.xz
added more clarity to required_by fields
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 d4250f3..fb548e9 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):