Show the last action date and user on the application list

This commit is contained in:
2011-01-14 10:45:45 +00:00
parent 74bd5ef90c
commit ef977c0fe6
2 changed files with 11 additions and 1 deletions

View File

@@ -77,6 +77,12 @@ class Application(models.Model):
return blacklist return blacklist
@property
def last_action(self):
if self.audit_set.count():
return self.audit_set.all().order_by('-date')[0]
return None
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
user = None user = None

View File

@@ -15,12 +15,16 @@
<tr><th><a href="{% url hr.views.admin_applications %}?o=id">Application ID</a></th> <tr><th><a href="{% url hr.views.admin_applications %}?o=id">Application ID</a></th>
<th><a href="{% url hr.views.admin_applications %}?o=character">Character</a></th> <th><a href="{% url hr.views.admin_applications %}?o=character">Character</a></th>
<th><a href="{% url hr.views.admin_applications %}?o=corporation">Corporation</a></th> <th><a href="{% url hr.views.admin_applications %}?o=corporation">Corporation</a></th>
<th>Application Status</th></tr> <th>Application Status</th>
<th>Last Action Date</th>
<th>Last Action User</th></tr>
{% for app in apps %} {% for app in apps %}
<tr><td><a href="{% url hr.views.view_application app.id %}">{{ app.id }}</a></td> <tr><td><a href="{% url hr.views.view_application app.id %}">{{ app.id }}</a></td>
<td>{{ app.character }}</td> <td>{{ app.character }}</td>
<td>{{ app.corporation }}</td> <td>{{ app.corporation }}</td>
<td>{{ app.get_status_display }}</td> <td>{{ app.get_status_display }}</td>
<td>{{ app.last_action.date }}</td>
<td>{{ app.last_action.user }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>