Skip to content
Snippets Groups Projects
Commit e43f55f9 authored by Dan Braghis's avatar Dan Braghis
Browse files

Add last update information to the submission table

parent 8d6b2728
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,9 @@ class ActivityQuerySet(BaseActivityQuerySet): ...@@ -27,6 +27,9 @@ class ActivityQuerySet(BaseActivityQuerySet):
def comments(self): def comments(self):
return self.filter(type=COMMENT) return self.filter(type=COMMENT)
def actions(self):
return self.filter(type=ACTION)
class ActivityBaseManager(models.Manager): class ActivityBaseManager(models.Manager):
def create(self, **kwargs): def create(self, **kwargs):
......
...@@ -27,13 +27,15 @@ class SubmissionsTable(tables.Table): ...@@ -27,13 +27,15 @@ class SubmissionsTable(tables.Table):
stage = tables.Column(verbose_name="Type", order_by=('status',)) stage = tables.Column(verbose_name="Type", order_by=('status',))
page = tables.Column(verbose_name="Fund") page = tables.Column(verbose_name="Fund")
comments = tables.Column(accessor='activities.comments.all', verbose_name="Comments") comments = tables.Column(accessor='activities.comments.all', verbose_name="Comments")
last_update = tables.Column(accessor='activities.actions.last', verbose_name="Last update", visible=False)
class Meta: class Meta:
model = ApplicationSubmission model = ApplicationSubmission
order_by = ('-submit_time',) order_by = ('-submit_time',)
fields = ('title', 'status_name', 'stage', 'page', 'round', 'submit_time') fields = ('title', 'status_name', 'stage', 'page', 'round', 'submit_time')
sequence = fields + ('comments',) sequence = fields + ('comments',)
template = 'funds/tables/table.html' extra_columns = ('last_update',)
template_name = 'funds/tables/table.html'
row_attrs = { row_attrs = {
'class': make_row_class 'class': make_row_class
} }
......
{% extends 'django_tables2/table.html' %} {% extends 'django_tables2/table.html' %}
{% load table_tags %} {% load table_tags django_tables2 %}
{# example of how to extend the table template #} {# example of how to extend the table template #}
{% block table.tbody.row %} {% block table.tbody.row %}
{{ block.super }} <tr {{ row.attrs.as_html }} data-record-id="{{ row.record.id }}">
{% for column, cell in row.items %}
<td {{ column.attrs.td.as_html }}>{% if column.localize == None %}{{ cell }}{% else %}{% if column.localize %}{{ cell|localize }}{% else %}{{ cell|unlocalize }}{% endif %}{% endif %}</td>
{% endfor %}
</tr>
{% with submission=row.record %} {% with submission=row.record %}
{# placeholder for example data row #} {# placeholder for example data row #}
<tr class="child"> <tr class="child" data-parent-id="{{ row.record.id }}">
<td>Applicant: {{ submission.full_name }}</td> <td colspan="{{ table.columns|length }}">
<table>
<tr>
<th>Applicant</th>
<th>Last updated</th>
<th>Next deadline</th>
<th>Reviewers / Outcomes</th>
</tr>
<tr>
<td>{{ submission.full_name }}</td>
<td>
<strong>by {{ row.cells.last_update.user }}</strong><br/>
{{ row.cells.last_update.timestamp|date:"m.d.y \a\t H:i" }}
</td>
<td></td>
<td></td>
</tr>
</table>
</td>
</tr> </tr>
{% endwith %} {% endwith %}
{% if row.record.previous %} {% if row.record.previous %}
{# we have a linked application #} {# we have a linked application #}
{# re-render the header row #} {# re-render the header row #}
<tr class="child"> <tr class="child" data-parent-id="{{ row.record.id }}">
{% for column in row.table.columns %} <td colspan="{{ table.columns|length }}">
<th>{{ column.header }}</th> <table>
{% endfor %} <tr>
{% for column in row.table.columns %}
{% if forloop.first %}
<th>Linked {{ row.record.previous.stage }}</th>
{% else %}
<th>{{ column.header }}</th>
{% endif %}
{% endfor %}
</tr>
{# mutate the row to render the data for the child row #}
{% with row=row|row_from_record:row.record.previous %}
{{ block.super }}
{% endwith %}
</table>
</td>
</tr> </tr>
{# mutate the row to render the data for the child row #}
{% with row=row|row_from_record:row.record.previous %}
{{ block.super }}
{% endwith %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
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