diff --git a/konova/views/home.py b/konova/views/home.py index 98cbaee3..b62e63e6 100644 --- a/konova/views/home.py +++ b/konova/views/home.py @@ -35,6 +35,7 @@ def home_view(request: HttpRequest): template = "konova/home.html" now = timezone.now() user = request.user + user_teams = user.shared_teams # Fetch the four newest active and published ServerMessages msgs = ServerMessage.objects.filter( @@ -51,7 +52,7 @@ def home_view(request: HttpRequest): ) # Then fetch only user related ones user_interventions = interventions.filter( - Q(users__in=[user]) | Q(teams__in=user.shared_teams) + Q(users__in=[user]) | Q(teams__in=user_teams) ).distinct() # Repeat for other objects @@ -59,13 +60,13 @@ def home_view(request: HttpRequest): deleted=None, ) user_comps = comps.filter( - Q(intervention__users__in=[user]) | Q(intervention__teams__in=user.shared_teams) + Q(intervention__users__in=[user]) | Q(intervention__teams__in=user_teams) ).distinct() eco_accs = EcoAccount.objects.filter( deleted=None, ) user_ecco_accs = eco_accs.filter( - Q(users__in=[user]) | Q(teams__in=user.shared_teams) + Q(users__in=[user]) | Q(teams__in=user_teams) ).distinct() additional_context = {