return User objects for team responsible

This commit is contained in:
Thomas Steen Rasmussen 2017-04-03 09:22:15 +02:00
parent 8ed58664f2
commit 3be7319dc3

View file

@ -2,6 +2,7 @@ from django.db import models
from django.utils.text import slugify
from utils.models import CampRelatedModel
from django.core.exceptions import ValidationError
from django.contrib.auth.models import User
class TeamArea(CampRelatedModel):
@ -60,7 +61,7 @@ class Team(CampRelatedModel):
@property
def responsible(self):
if TeamMember.objects.filter(team=self, responsible=True).exists():
return TeamMember.objects.filter(team=self, responsible=True)
return User.objects.filter(teammember__team=self, teammember__responsible=True)
else:
return self.area.responsible.all()