From: Michael Tremer Date: Sun, 26 Jun 2022 14:50:47 +0000 (+0000) Subject: users: Show repositories grouped by distribution X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1be120a33697bc20f1aeb578acd2e2e6d607704;p=pbs.git users: Show repositories grouped by distribution Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/users.py b/src/buildservice/users.py index 518dd5ab..843a1f1b 100644 --- a/src/buildservice/users.py +++ b/src/buildservice/users.py @@ -390,7 +390,16 @@ class User(base.DataObject): self.id, ) - return list(repos) + distros = {} + + # Group by distro + for repo in repos: + try: + distros[repo.distro].append(repo) + except KeyError: + distros[repo.distro] = [repo] + + return distros def get_repo(self, distro, slug): return self.backend.repos._get_repository(""" diff --git a/src/templates/users/show.html b/src/templates/users/show.html index 25dad918..495a2120 100644 --- a/src/templates/users/show.html +++ b/src/templates/users/show.html @@ -38,7 +38,11 @@

{{ _("Repositories") }}

{% if user.repos %} - {% module ReposList(user.repos) %} + {% for distro in sorted(user.repos) %} +
{{ distro }}
+ + {% module ReposList(user.repos[distro]) %} + {% end %} {% end %}