Skip to content

Commit

Permalink
Show project users
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Jul 8, 2024
1 parent efea2ba commit 07a1acd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/templates/projects/project.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ <h2>{% translate 'catalogs'|capfirst %}</h2>
{% endfor %}
</ul>

<h2>{% translate 'users'|capfirst %}</h2>
<p>
{% for user in project.all_users %}<a href="mailto:{{ user.email }}">{{ user.get_full_name }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}
</p>

<h2>{% translate 'CLI configuration' %}</h2>
<details>
<summary><code>~/.config/traduire.toml</code></summary>
Expand Down
9 changes: 9 additions & 0 deletions projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
from django.conf import global_settings, settings
from django.core import validators
from django.db import models
from django.db.models import Q
from django.urls import reverse
from django.utils.timesince import timesince
from django.utils.translation import gettext_lazy as _

from accounts.models import User


class ChoicesCharField(models.CharField):
"""
Expand Down Expand Up @@ -82,6 +85,12 @@ def get_api_url(self):
def pretty_timesince(self):
return timesince(self.updated_at, depth=1)

@cached_property
def all_users(self):
return User.objects.filter(
Q(is_active=True) & (Q(is_staff=True) | Q(projects=self))
)


class CatalogQuerySet(models.QuerySet):
def for_user(self, user):
Expand Down

0 comments on commit 07a1acd

Please sign in to comment.