return User objects for team responsible
This commit is contained in:
parent
8ed58664f2
commit
3be7319dc3
|
@ -2,6 +2,7 @@ from django.db import models
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
from utils.models import CampRelatedModel
|
from utils.models import CampRelatedModel
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
|
||||||
class TeamArea(CampRelatedModel):
|
class TeamArea(CampRelatedModel):
|
||||||
|
@ -60,7 +61,7 @@ class Team(CampRelatedModel):
|
||||||
@property
|
@property
|
||||||
def responsible(self):
|
def responsible(self):
|
||||||
if TeamMember.objects.filter(team=self, responsible=True).exists():
|
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:
|
else:
|
||||||
return self.area.responsible.all()
|
return self.area.responsible.all()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue