summaryrefslogtreecommitdiffstats
path: root/packages/models.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-04-13 20:05:02 +0200
committerDan McGee <dan@archlinux.org>2013-04-13 20:05:02 +0200
commit7fc8da7d959556b1204b7864959e73e7f5f5ec59 (patch)
tree4418bedeefbdff3d1c7bb2678656b98c978e24d7 /packages/models.py
parentf2a6316be0b025a9ee22f22d34df1c00f60a8bdf (diff)
downloadarchweb-7fc8da7d959556b1204b7864959e73e7f5f5ec59.tar.gz
archweb-7fc8da7d959556b1204b7864959e73e7f5f5ec59.tar.xz
Show replacments for package if it has been removed
This covers the case where we can't find the package in any other repositories, but it was removed recently enough that we have a found package update object. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages/models.py')
-rw-r--r--packages/models.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/packages/models.py b/packages/models.py
index 7bcdc00..92566a5 100644
--- a/packages/models.py
+++ b/packages/models.py
@@ -321,6 +321,15 @@ class Update(models.Model):
return Package.objects.normal().filter(
pkgname=self.pkgname, arch=self.arch)
+ def replacements(self):
+ pkgs = Package.objects.normal().filter(
+ replaces__name=self.pkgname)
+ if not self.arch.agnostic:
+ # make sure we match architectures if possible
+ arches = self.pkg.applicable_arches()
+ pkgs = pkgs.filter(arch__in=arches)
+ return pkgs
+
def __unicode__(self):
return u'%s of %s on %s' % (self.get_action_flag_display(),
self.pkgname, self.created)