Add PGP key to the Release model

Add a pgp_key field to the Release model so we can display the PGP
fingerprint of the used PGP key on the download page.

Closes: #282
This commit is contained in:
Jelle van der Waa 2020-05-23 01:23:55 +02:00
parent 1c831f6b5a
commit 5da8fa6ce1
4 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 3.0.6 on 2020-05-22 22:14
import devel.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('releng', '0002_auto_20181216_1605'),
]
operations = [
migrations.AddField(
model_name='release',
name='pgp_key',
field=devel.fields.PGPKeyField(blank=True, help_text='consists of 40 hex digits; use `gpg --fingerprint`', max_length=40, null=True, verbose_name='PGP key fingerprint'),
),
]

View File

@ -11,6 +11,7 @@
from django.utils.safestring import mark_safe
from main.utils import set_created_field, parse_markdown
from devel.fields import PGPKeyField
class Release(models.Model):
@ -19,6 +20,8 @@ class Release(models.Model):
kernel_version = models.CharField(max_length=50, blank=True)
md5_sum = models.CharField('MD5 digest', max_length=32, blank=True)
sha1_sum = models.CharField('SHA1 digest', max_length=40, blank=True)
pgp_key = PGPKeyField(max_length=40, verbose_name="PGP key fingerprint", null=True, blank=True,
help_text="consists of 40 hex digits; use `gpg --fingerprint`")
created = models.DateTimeField(editable=False)
last_modified = models.DateTimeField(editable=False)
available = models.BooleanField(default=True)

View File

@ -2,6 +2,7 @@
{% load cache %}
{% load static %}
{% load flags %}
{% load pgp %}
{% block title %}Arch Linux - Downloads{% endblock %}
@ -98,6 +99,7 @@ <h4>Checksums</h4>
<ul>
<li><a href="https://www.archlinux.org/{{ release.iso_url }}.sig"
title="PGP signature">PGP signature</a></li>
{% if release.pgp_key %}<li><strong>PGP fingerprint:</strong> {% pgp_key_link release.pgp_key %}</li>{% endif %}
{% if release.md5_sum %}<li><strong>MD5:</strong> {{ release.md5_sum }}</li>{% endif %}
{% if release.sha1_sum %}<li><strong>SHA1:</strong> {{ release.sha1_sum }}</li>{% endif %}
</ul>

View File

@ -1,5 +1,6 @@
{% extends "base.html" %}
{% load static %}
{% load pgp %}
{% block title %}Arch Linux - Release: {{ release.version }}{% endblock %}
@ -21,6 +22,7 @@ <h2>{{ release.version }}</h2>
{% endif %}
{% if release.md5_sum %}<li><strong>MD5:</strong> {{ release.md5_sum }}</li>{% endif %}
{% if release.sha1_sum %}<li><strong>SHA1:</strong> {{ release.sha1_sum }}</li>{% endif %}
{% if release.pgp_key %}<li><strong>PGP fingerprint:</strong> {% pgp_key_link release.pgp_key %}</li>{% endif %}
</ul>
{% if release.info %}