From 37361f664f5092d5f4cc7bb2a20e1e86cbbf558d Mon Sep 17 00:00:00 2001 From: eliott Date: Sat, 8 Mar 2008 20:41:08 -0800 Subject: some model fixes --- main/models.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'main') diff --git a/main/models.py b/main/models.py index 80091756..44a8065e 100644 --- a/main/models.py +++ b/main/models.py @@ -179,25 +179,27 @@ def get_absolute_url(self): 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( - '
  • %s
  • ' % \ - (req.id,req.pkgname)) + '
  • %s
  • ' % \ + (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('
  • %s (v)
  • ' % dep.depname) continue urls.append( - '
  • %s
  • ' % (p.id,dep.depname)) + '
  • %s%s
  • ' % \ + (p.id,dep.depname,dep.depvcmp)) return ''.join(urls) class PackageFile(models.Model): -- cgit v1.2.3-54-g00ecf