diff options
author | eliott <eliott@cactuswax.net> | 2008-03-09 05:41:08 +0100 |
---|---|---|
committer | eliott <eliott@cactuswax.net> | 2008-03-09 05:41:08 +0100 |
commit | 37361f664f5092d5f4cc7bb2a20e1e86cbbf558d (patch) | |
tree | a8422432c89c1bfdc0cfbc53807f24aa0745fac0 /main | |
parent | 4380bd20e44d9e839c3456dadefe4b45de5187ff (diff) | |
download | archweb-37361f664f5092d5f4cc7bb2a20e1e86cbbf558d.tar.gz archweb-37361f664f5092d5f4cc7bb2a20e1e86cbbf558d.tar.xz |
some model fixes
Diffstat (limited to 'main')
-rw-r--r-- | main/models.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/main/models.py b/main/models.py index 8009175..44a8065 100644 --- a/main/models.py +++ b/main/models.py @@ -179,25 +179,27 @@ class Package(models.Model): def required_by_urlize(self): urls = [] requiredby = PackageDepends.objects.filter(depname=self.pkgname) - for req in requiredby.package_set.all(): + for req in requiredby: urls.append( - '<li><a href="/packages/%d">%s</a></li>' % \ - (req.id,req.pkgname)) + '<li><a href="/packages/%d/">%s</a></li>' % \ + (req.pkg.id,req.pkg.pkgname)) return ''.join(urls) - def depends_urlize(self): urls = [] for dep in self.packagedepends_set.all(): try: - p = Package.objects.filter(pkgname=dep.depname) + p = Package.objects.get( + pkgname=dep.depname, + arch=self.arch) except IndexError: # couldn't find a package in the DB # it might be a virtual depend urls.append('<li>%s (v)</li>' % dep.depname) continue urls.append( - '<li><a href="/packages/%d">%s</a></li>' % (p.id,dep.depname)) + '<li><a href="/packages/%d/">%s</a>%s</li>' % \ + (p.id,dep.depname,dep.depvcmp)) return ''.join(urls) class PackageFile(models.Model): |