diff options
author | Dan McGee <dan@archlinux.org> | 2012-01-03 14:17:56 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-01-03 14:17:59 -0600 |
commit | 64da32a3f3312331537eb34ab704eec7ebf14221 (patch) | |
tree | b125aa135d7d26bc469acdb784a4762f6f01fc26 /packages/views | |
parent | ab97f5cdea4d54bbb8dff34b0333f5b965052e91 (diff) |
Add maintainer and packager data to package JSON view
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages/views')
-rw-r--r-- | packages/views/__init__.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/views/__init__.py b/packages/views/__init__.py index aa7da262..9f24056a 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): |