diff --git a/smash/web/models/worker.py b/smash/web/models/worker.py index c631fd4e12d048cabf23b3c48529a1e477dffa57..daadd9c6e1a0b55fe82f1016e2104f886fbf8eed 100644 --- a/smash/web/models/worker.py +++ b/smash/web/models/worker.py @@ -161,6 +161,14 @@ class Worker(models.Model): else: return False + @property + def role(self): + roles = self.roles.filter(study=GLOBAL_STUDY_ID) + if roles.count() == 0: + return WORKER_STAFF + role = roles[0].role + return role + @staticmethod def get_by_user(the_user): if isinstance(the_user, User): diff --git a/smash/web/templates/doctors/index.html b/smash/web/templates/doctors/index.html index 6960412e877ef7582b29e6dd3bb01060f1ffff44..93d2bf58d6a0e86f891afa629cab2fadd74b8459 100644 --- a/smash/web/templates/doctors/index.html +++ b/smash/web/templates/doctors/index.html @@ -38,6 +38,7 @@ <th>First name</th> <th>Last name</th> <th>Unit</th> + <th>Role</th> {% else %} <th>Name</th> {% endif %} @@ -57,6 +58,7 @@ <td>{{ worker.first_name }}</td> <td>{{ worker.last_name }}</td> <td>{{ worker.unit }}</td> + <td>{{ worker.role }}</td> {% else %} <td>{{ worker.name }}</td> {% endif %}