diff options
author | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2011-05-21 02:29:15 -0300 |
---|---|---|
committer | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2011-05-21 02:29:15 -0300 |
commit | 01704e43379f7b7c9b6b248990ff7bee37ab4cdf (patch) | |
tree | 4e93715c275150a77a4ad5f5d719f9a7553fce58 /devel | |
parent | 5897fba6d3242cc7188d05f8f3be7362a8383761 (diff) | |
parent | 7c663a77b187e4592ce112da4bd1588a4ac066bc (diff) |
Merge branch 'master' of git://projects.archlinux.org/archweb
Diffstat (limited to 'devel')
-rw-r--r-- | devel/urls.py | 1 | ||||
-rw-r--r-- | devel/views.py | 22 |
2 files changed, 19 insertions, 4 deletions
diff --git a/devel/urls.py b/devel/urls.py index 9bf50f45..8759562e 100644 --- a/devel/urls.py +++ b/devel/urls.py @@ -7,6 +7,7 @@ urlpatterns = patterns('devel.views', (r'^$', 'index'), (r'^newuser/$', 'new_user_form'), (r'^profile/$', 'change_profile'), + (r'^reports/(?P<report>.*)/(?P<username>.*)/$', 'report'), (r'^reports/(?P<report>.*)/$', 'report'), ) diff --git a/devel/views.py b/devel/views.py index 5d34cc41..c0d10285 100644 --- a/devel/views.py +++ b/devel/views.py @@ -128,18 +128,21 @@ def change_profile(request): {'form': form, 'profile_form': profile_form}) @login_required -def report(request, report): +def report(request, report, username=None): title = 'Developer Report' packages = Package.objects.select_related('arch', 'repo') - names = attrs = None + names = attrs = user = None + if report == 'old': title = 'Packages last built more than two years ago' cutoff = datetime.now() - timedelta(days=730) - packages = packages.filter(build_date__lt=cutoff).order_by('build_date') + packages = packages.filter( + build_date__lt=cutoff).order_by('build_date') elif report == 'big': title = 'Packages with compressed size > 50 MiB' cutoff = 50 * 1024 * 1024 - packages = packages.filter(compressed_size__gte=cutoff).order_by('-compressed_size') + packages = packages.filter( + compressed_size__gte=cutoff).order_by('-compressed_size') names = [ 'Compressed Size', 'Installed Size' ] attrs = [ 'compressed_size_pretty', 'installed_size_pretty' ] # Format the compressed and installed sizes with MB/GB/etc suffixes @@ -175,8 +178,19 @@ def report(request, report): else: raise Http404 + if username: + user = get_object_or_404(User, username=username, is_active=True) + maintained = PackageRelation.objects.filter(user=user, + type=PackageRelation.MAINTAINER).values('pkgbase') + packages = packages.filter(pkgbase__in=maintained) + + maints = User.objects.filter(id__in=PackageRelation.objects.filter( + type=PackageRelation.MAINTAINER).values('user')) + context = { + 'all_maintainers': maints, 'title': title, + 'maintainer': user, 'packages': packages, 'column_names': names, 'column_attrs': attrs, |