Skip to content

Commit e9de80f

Browse files
committed
Use Django template syntax
1 parent c8fb563 commit e9de80f

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

downloads/templatetags/download_tags.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@
66
@register.filter
77
def strip_minor_version(version):
88
return '.'.join(version.split('.')[:2])
9+
10+
11+
@register.filter
12+
def has_sigstore_materials(files):
13+
return any(f.sigstore_cert_file or f.sigstore_signature_file for f in files)

templates/downloads/release_detail.html

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ <h1 class="page-title">{{ release.name }}</h1>
4040
<h1 class="page-title">Files</h1>
4141
</header>
4242

43-
{% set has_sigstore_materials = false %}
44-
{% for f in release_files %}
45-
{% if f.sigstore_cert_file or f.sigstore_signature_file %}
46-
{% set has_sigstore_materials = true %}
47-
{% endif %}
48-
{% endfor %}
49-
5043
<table>
5144
<thead>
5245
<tr>
@@ -56,7 +49,7 @@ <h1 class="page-title">Files</h1>
5649
<th>MD5 Sum</th>
5750
<th>File Size</th>
5851
<th>GPG</th>
59-
{% if has_sigstore_materials %}
52+
{% if release_files|has_sigstore_materials %}
6053
<th colspan="2">Sigstore</th>
6154
{% endif %}
6255
</tr>
@@ -70,7 +63,7 @@ <h1 class="page-title">Files</h1>
7063
<td>{{ f.md5_sum }}</td>
7164
<td>{{ f.filesize }}</td>
7265
<td>{% if f.gpg_signature_file %}<a href="{{ f.gpg_signature_file }}">SIG</a>{% endif %}</td>
73-
{% if has_sigstore_materials %}
66+
{% if release_files|has_sigstore_materials %}
7467
<td>{% if f.sigstore_cert_file %}<a href="{{ f.sigstore_cert_file}}">CRT</a>{% endif %}</td>
7568
<td>{% if f.sigstore_signature_file %}<a href="{{ f.sigstore_signature_file }}">SIG</a>{% endif %}</td>
7669
{% endif %}

0 commit comments

Comments
 (0)