summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/views/display.py24
-rw-r--r--templates/packages/removed.html12
2 files changed, 26 insertions, 10 deletions
diff --git a/packages/views/display.py b/packages/views/display.py
index d6922314..8adf3bee 100644
--- a/packages/views/display.py
+++ b/packages/views/display.py
@@ -50,12 +50,19 @@ def recently_removed_package(request, name, repo, arch, cutoff=CUTOFF):
when = now() - cutoff
match = match.filter(created__gte=when)
try:
- match = match.latest()
- elsewhere = match.elsewhere()
+ update = match.latest()
+ elsewhere = update.elsewhere()
if len(elsewhere) == 1:
return redirect(elsewhere[0])
- return render(request, 'packages/removed.html',
- {'update': match, }, status=410)
+ context = {
+ 'update': update,
+ 'elsewhere': elsewhere,
+ 'name': name,
+ 'version': update.old_version,
+ 'arch': arch,
+ 'repo': repo,
+ }
+ return render(request, 'packages/removed.html', context, status=410)
except Update.DoesNotExist:
return None
@@ -66,6 +73,15 @@ def replaced_package(request, name, repo, arch):
match = Package.objects.filter(replaces__name=name, repo=repo, arch=arch)
if len(match) == 1:
return redirect(match[0], permanent=True)
+ elif len(match) > 1:
+ context = {
+ 'elsewhere': match,
+ 'name': name,
+ 'version': '',
+ 'arch': arch,
+ 'repo': repo,
+ }
+ return render(request, 'packages/removed.html', context, status=410)
return None
diff --git a/templates/packages/removed.html b/templates/packages/removed.html
index 17b1f989..ea20ce80 100644
--- a/templates/packages/removed.html
+++ b/templates/packages/removed.html
@@ -2,17 +2,17 @@
{% load url from future %}
{% load package_extras %}
-{% block title %}Arch Linux - Not Available - {{ update.pkgname }} {{ update.old_version }} ({{ update.arch.name }}){% endblock %}
+{% block title %}Arch Linux - Not Available - {{ name }} {{ version }} ({{ arch.name }}){% endblock %}
{% block navbarclass %}anb-packages{% endblock %}
{% block content %}
<div id="pkg-gone" class="box">
- <h2>{{ update.pkgname }} {{ update.old_version }} is no longer available</h2>
+ <h2>{{ name }} {{ version }} is no longer available</h2>
- <p>{{ update.pkgname }} {{ update.old_version }} has been removed from the [{{ update.repo.name|lower }}] repository.</p>
+ <p>{{ name }} {{ version }} has been removed from the [{{ repo.name|lower }}] repository.</p>
- {% with update.elsewhere as elsewhere %}{% if elsewhere %}
- <p>However, this package is available in other repositories:</p>
+ {% if elsewhere %}
+ <p>However, this package or replacements are available elsewhere:</p>
<ul>
{% for pkg in elsewhere %}
<li>{% pkg_details_link pkg %} {{ pkg.full_version }} [{{ pkg.repo.name|lower }}] ({{ pkg.arch.name }})</li>
@@ -23,6 +23,6 @@
Try using the <a href="{% url 'packages-search' %}?name={{ update.pkgname|urlencode }}">package search page</a>,
or try <a href="https://aur.archlinux.org/packages.php?K={{ update.pkgname|urlencode }}">searching the AUR</a>
to see if the package can be found there.</p>
- {% endif %}{% endwith %}
+ {% endif %}
</div>
{% endblock %}