• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

liqd / adhocracy-plus / 18908688697

29 Oct 2025 12:59PM UTC coverage: 44.622% (-44.5%) from 89.135%
18908688697

Pull #2986

github

web-flow
Merge 1dfde8ee7 into 445e1d498
Pull Request #2986: Draft: Speed up Github Ci Tests

3012 of 6750 relevant lines covered (44.62%)

0.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/apps/users/views.py
1
from django.utils.translation import check_for_language
×
2
from django.views.generic.detail import DetailView
×
3
from django.views.i18n import LANGUAGE_QUERY_PARAMETER
×
4
from django.views.i18n import set_language
×
5

6
from adhocracy4.actions.models import Action
×
7
from apps.organisations.models import Organisation
×
8

9
from . import models
×
10

11

12
class ProfileView(DetailView):
×
13
    model = models.User
×
14
    slug_field = "username"
×
15

16
    @property
×
17
    def projects_carousel(self):
×
18
        (
×
19
            sorted_active_projects,
20
            sorted_future_projects,
21
            sorted_past_projects,
22
        ) = self.object.get_projects_follow_list(exclude_private_projects=True)
23
        return (
×
24
            list(sorted_active_projects)
25
            + list(sorted_future_projects)
26
            + list(sorted_past_projects)
27
        )[:6]
28

29
    @property
×
30
    def organisations(self):
×
31
        return Organisation.objects.filter(
×
32
            project__follow__creator=self.object, project__follow__enabled=True
33
        ).distinct()
34

35
    @property
×
36
    def actions(self):
×
37
        return (
×
38
            Action.objects.filter(
39
                actor=self.object,
40
            )
41
            .filter_public()
42
            .exclude_updates()[:25]
43
        )
44

45

46
def set_language_overwrite(request):
×
47
    """Overwrite Djangos set_language to update the user language when switching via
48
    the language indicator"""
49
    if request.method == "POST":
×
50
        lang_code = request.POST.get(LANGUAGE_QUERY_PARAMETER)
×
51
        if lang_code and check_for_language(lang_code):
×
52
            user = request.user
×
53
            if hasattr(user, "language"):
×
54
                if user.language != lang_code:
×
55
                    user.language = lang_code
×
56
                    user.save()
×
57
    return set_language(request)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc