diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-12-22 21:57:02 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-12-22 21:57:02 -0500 |
commit | f545de301a3188eefffb79de018d5fda2f03946d (patch) | |
tree | c30c10c3cef88d84a6e38a43b63ddf5c4f83d2f5 /main | |
parent | 2e634dc457a35d06ec83409da3d6006107495569 (diff) | |
parent | 2bfec5b17ca3ee3ea3b347c029b9d8dad3c5b4d0 (diff) |
Merge branch 'archweb-generic' into master-nomake
Conflicts:
README.md
Diffstat (limited to 'main')
-rw-r--r-- | main/admin.py | 4 | ||||
-rw-r--r-- | main/models.py | 2 | ||||
-rw-r--r-- | main/templatetags/bugs.py | 6 | ||||
-rw-r--r-- | main/templatetags/pgp.py | 18 |
4 files changed, 24 insertions, 6 deletions
diff --git a/main/admin.py b/main/admin.py index 6aff12e5..ec2b5bc8 100644 --- a/main/admin.py +++ b/main/admin.py @@ -1,23 +1,27 @@ from django.contrib import admin from main.models import Arch, Donor, Package, Repo + class DonorAdmin(admin.ModelAdmin): list_display = ('name', 'visible', 'created') list_filter = ('visible', 'created') search_fields = ('name',) exclude = ('created',) + class ArchAdmin(admin.ModelAdmin): list_display = ('name', 'agnostic', 'required_signoffs') list_filter = ('agnostic',) search_fields = ('name',) + class RepoAdmin(admin.ModelAdmin): list_display = ('name', 'testing', 'staging', 'bugs_project', 'bugs_category', 'svn_root') list_filter = ('testing', 'staging') search_fields = ('name',) + class PackageAdmin(admin.ModelAdmin): list_display = ('pkgname', 'full_version', 'repo', 'arch', 'packager', 'last_update', 'build_date') diff --git a/main/models.py b/main/models.py index 8d9d4c89..bf7a9409 100644 --- a/main/models.py +++ b/main/models.py @@ -97,7 +97,7 @@ class Package(models.Model): pkgrel = models.CharField(max_length=255) epoch = models.PositiveIntegerField(default=0) pkgdesc = models.TextField('description', null=True) - url = models.CharField(max_length=255, null=True) + url = models.CharField('URL', max_length=255, null=True) filename = models.CharField(max_length=255) compressed_size = PositiveBigIntegerField() installed_size = PositiveBigIntegerField() diff --git a/main/templatetags/bugs.py b/main/templatetags/bugs.py new file mode 100644 index 00000000..d5764435 --- /dev/null +++ b/main/templatetags/bugs.py @@ -0,0 +1,6 @@ +from django import template +register = template.Library() + +@register.simple_tag +def bug_link(bugid): + return "<a href=\"https://bugs.archlinux.org/task/"+bugid+"\">FS#"+bugid+"</a>" diff --git a/main/templatetags/pgp.py b/main/templatetags/pgp.py index e93e5bca..cc080439 100644 --- a/main/templatetags/pgp.py +++ b/main/templatetags/pgp.py @@ -3,6 +3,7 @@ from django.conf import settings from django.utils.html import conditional_escape from django.utils.safestring import mark_safe +from ..utils import cache_function from devel.models import DeveloperKey register = template.Library() @@ -42,15 +43,22 @@ def pgp_key_link(key_id, link_text=None): values = (url, format_key(key_id), link_text) return '<a href="%s" title="PGP key search for %s">%s</a>' % values -@register.simple_tag -def user_pgp_key_link(key_id): - normalized = key_id[-16:] + +@cache_function(1800) +def name_for_key(normalized): try: matching_key = DeveloperKey.objects.select_related( 'owner').get(key=normalized, owner_id__isnull=False) + return matching_key.owner.get_full_name() except DeveloperKey.DoesNotExist: - return pgp_key_link(key_id) - return pgp_key_link(key_id, matching_key.owner.get_full_name()) + return None + + +@register.simple_tag +def user_pgp_key_link(key_id): + normalized = key_id[-16:] + name = name_for_key(normalized) + return pgp_key_link(key_id, name) @register.filter(needs_autoescape=True) |