From 0403ca15e685a69f98e23ff0b4c6029bc160132d Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 17 Sep 2023 00:45:15 +0300 Subject: [PATCH 1/4] Prioritise 64-bit downloads over 32-bit --- downloads/templatetags/download_tags.py | 18 ++++++++++++++++++ templates/downloads/os_list.html | 5 +++-- templates/downloads/release_detail.html | 3 ++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/downloads/templatetags/download_tags.py b/downloads/templatetags/download_tags.py index fb3496787..263aa9a5f 100644 --- a/downloads/templatetags/download_tags.py +++ b/downloads/templatetags/download_tags.py @@ -14,3 +14,21 @@ def has_sigstore_materials(files): f.sigstore_bundle_file or f.sigstore_cert_file or f.sigstore_signature_file for f in files ) + + +@register.filter +def prioritise_64bit_over_32bit(files): + if not files: + return files + + # Put 64-bit files before 32-bit + new = [] + previous = files[0] + for i, current in enumerate(files): + if i >= 1 and '(64-bit)' in current.name and '(32-bit)' in previous.name: + new.insert(-1, current) + else: + new.append(current) + previous = current + + return new diff --git a/templates/downloads/os_list.html b/templates/downloads/os_list.html index 67db5233f..b4c42c6d9 100644 --- a/templates/downloads/os_list.html +++ b/templates/downloads/os_list.html @@ -1,6 +1,7 @@ {% extends "downloads/base.html" %} {% load boxes %} {% load sitetree %} +{% load prioritise_64bit_over_32bit from download_tags %} {% block body_attributes %}class="python download"{% endblock %} @@ -45,7 +46,7 @@

Stable Releases

{% endif %} {% endif %}