Browse Source

Show last person to act on a rrequest on dashboard

Sebastian Lohff 2 years ago
parent
commit
370bbe58af
2 changed files with 10 additions and 0 deletions
  1. 8
    0
      rrequests/models.py
  2. 2
    0
      templates/dncore/dashboard.html

+ 8
- 0
rrequests/models.py View File

@@ -33,6 +33,14 @@ class Request(models.Model):
33 33
 	def __str__(self):
34 34
 		return "(%s -> %s) [%s] %s" % (self.applicant, self.provider, self.status, self.subject)
35 35
 
36
+	def getLastActionBy(self):
37
+		msgs = self.requestmessage_set.order_by("-created")
38
+
39
+		if msgs.count() > 0:
40
+			return msgs[0].creator
41
+		else:
42
+			return None
43
+
36 44
 
37 45
 class RequestMessage(models.Model):
38 46
 	request = models.ForeignKey(Request)

+ 2
- 0
templates/dncore/dashboard.html View File

@@ -96,11 +96,13 @@
96 96
 						<tr>
97 97
 							<th>From</th>
98 98
 							<th>Subject</th>
99
+							<th>Last</th>
99 100
 						</tr>
100 101
 					{% for rrequest in rrequests %}
101 102
 						<tr>
102 103
 							<td>{{ rrequest.applicant }} <span class="glyphicon glyphicon-arrow-right"></span> {{ rrequest.provider }}</td>
103 104
 							<td><a href="{{ rrequest.get_absolute_url }}">{{ rrequest.subject }}</a></td>
105
+							<td>{{ rrequest.getLastActionBy }}</td>
104 106
 						</tr>
105 107
 					{% endfor %}
106 108
 					</table>

Loading…
Cancel
Save