Skip to content
Snippets Groups Projects
Commit 574315a6 authored by Carlos Vega's avatar Carlos Vega
Browse files

added role column to worker list. Issue #238

parent ee3fa6f6
No related branches found
No related tags found
1 merge request!162added role column to worker list. Issue #238
Pipeline #6496 passed
...@@ -161,6 +161,14 @@ class Worker(models.Model): ...@@ -161,6 +161,14 @@ class Worker(models.Model):
else: else:
return False 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 @staticmethod
def get_by_user(the_user): def get_by_user(the_user):
if isinstance(the_user, User): if isinstance(the_user, User):
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
<th>First name</th> <th>First name</th>
<th>Last name</th> <th>Last name</th>
<th>Unit</th> <th>Unit</th>
<th>Role</th>
{% else %} {% else %}
<th>Name</th> <th>Name</th>
{% endif %} {% endif %}
...@@ -57,6 +58,7 @@ ...@@ -57,6 +58,7 @@
<td>{{ worker.first_name }}</td> <td>{{ worker.first_name }}</td>
<td>{{ worker.last_name }}</td> <td>{{ worker.last_name }}</td>
<td>{{ worker.unit }}</td> <td>{{ worker.unit }}</td>
<td>{{ worker.role }}</td>
{% else %} {% else %}
<td>{{ worker.name }}</td> <td>{{ worker.name }}</td>
{% endif %} {% endif %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment