From 2847f5a1c0e5b1230d5dfce5250d57b9b8768211 Mon Sep 17 00:00:00 2001 From: Vivek Anand Date: Feb 15 2017 10:28:57 +0000 Subject: Show groups in the contributors list as well Signed-off-by: Vivek Anand --- diff --git a/pagure/lib/model.py b/pagure/lib/model.py index bdde911..91f5be6 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -650,6 +650,18 @@ class Project(BASE): return contributors + @property + def contributor_groups(self): + """ Return the dict presenting the different contributors of the + project based on their access level. + """ + contributors = collections.defaultdict(list) + + for group in self.projects_groups: + contributors[group.access].append(group.group) + + return contributors + def to_json(self, public=False, api=False): ''' Return a representation of the project as JSON. ''' @@ -1826,6 +1838,12 @@ class ProjectGroup(BASE): ), nullable=False) + project = relation( + 'Project', remote_side=[Project.id], + backref='projects_groups') + + group = relation('PagureGroup', backref='projects_groups') + # Constraints __table_args__ = (sa.UniqueConstraint('project_id', 'group_id'),) diff --git a/pagure/templates/repo_info.html b/pagure/templates/repo_info.html index f641861..af31ad3 100644 --- a/pagure/templates/repo_info.html +++ b/pagure/templates/repo_info.html @@ -75,12 +75,15 @@ git push -u origin master {% endfor %} {% endfor %} - {% for group in repo.admin_groups %} -
- - @{{ group.group_name }} - -
+ {% for access in repo.contributor_groups %} + {% for group in repo.contributor_groups[access] %} +
+ + @{{ group.group_name }} + + - {{ access }} +
+ {% endfor %} {% endfor %}
Branches