summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreliott <eliott@cactuswax.net>2008-04-17 19:44:26 -0700
committereliott <eliott@cactuswax.net>2008-04-17 19:44:26 -0700
commit3d9c71dc0a5eeafcdd323cb1cbe06ff77d7c2d54 (patch)
tree5f3b85f2f3d9c5897b98bddc3cf505b5501b3583
parentdc6f471349d090245d7a1641e830bcb95a14e026 (diff)
downloadarchweb-3d9c71dc0a5eeafcdd323cb1cbe06ff77d7c2d54.tar.gz
archweb-3d9c71dc0a5eeafcdd323cb1cbe06ff77d7c2d54.zip
added more clarity to required_by fields
-rw-r--r--main/models.py11
-rw-r--r--templates/packages/details.html2
2 files changed, 5 insertions, 8 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):
diff --git a/templates/packages/details.html b/templates/packages/details.html
index facb697f..7e8c7d36 100644
--- a/templates/packages/details.html
+++ b/templates/packages/details.html
@@ -70,7 +70,7 @@
<h4>Required By:</h4>
<ul style="font-size:small;list-style:none">
{% for req in pkg.get_requiredby %}
- <li><a href="/packages/{{ req.0 }}/">{{ req.1 }}</a></li>
+ <li><a href="/packages/{{ req.id }}/">{{ req.pkgname }}{% ifequal req.repo.name "Testing" %}(testing){% endifequal %}{% ifequal req.repo.name "Unstable" %}(unstable){% endifequal %}</a></li>
{% endfor %}
</ul>
</div>