summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-01-03 21:17:56 +0100
committerDan McGee <dan@archlinux.org>2012-01-03 21:17:59 +0100
commit64da32a3f3312331537eb34ab704eec7ebf14221 (patch)
treeb125aa135d7d26bc469acdb784a4762f6f01fc26 /packages
parentab97f5cdea4d54bbb8dff34b0333f5b965052e91 (diff)
downloadarchweb-64da32a3f3312331537eb34ab704eec7ebf14221.tar.gz
archweb-64da32a3f3312331537eb34ab704eec7ebf14221.tar.xz
Add maintainer and packager data to package JSON view
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages')
-rw-r--r--packages/views/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/views/__init__.py b/packages/views/__init__.py
index aa7da26..9f24056 100644
--- a/packages/views/__init__.py
+++ b/packages/views/__init__.py
@@ -1,5 +1,6 @@
from django.contrib import messages
from django.contrib.auth.decorators import permission_required
+from django.contrib.auth.models import User
from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse, Http404
from django.shortcuts import get_object_or_404, redirect
@@ -27,7 +28,8 @@ from .signoff import signoffs, signoff_package, signoff_options, signoffs_json
class PackageJSONEncoder(DjangoJSONEncoder):
pkg_attributes = [ 'pkgname', 'pkgbase', 'repo', 'arch', 'pkgver',
'pkgrel', 'epoch', 'pkgdesc', 'url', 'filename', 'compressed_size',
- 'installed_size', 'build_date', 'last_update', 'flag_date' ]
+ 'installed_size', 'build_date', 'last_update', 'flag_date',
+ 'maintainers', 'packager' ]
def default(self, obj):
if hasattr(obj, '__iter__'):
@@ -43,6 +45,8 @@ class PackageJSONEncoder(DjangoJSONEncoder):
return obj.directory + filename
if isinstance(obj, (Repo, Arch, PackageGroup)):
return obj.name.lower()
+ elif isinstance(obj, User):
+ return obj.username
return super(PackageJSONEncoder, self).default(obj)
def opensearch(request):