summaryrefslogtreecommitdiff
path: root/pgcommitfest/commitfest
diff options
context:
space:
mode:
authorMagnus Hagander2015-02-08 15:54:12 +0000
committerMagnus Hagander2015-02-08 15:54:12 +0000
commitec2f174e5c9d27630a4e7f507761edbdecffbe9c (patch)
tree05c767f7cd0d8d8896653191008446c93b44f8e2 /pgcommitfest/commitfest
parent2bf6b909fd42f09ada9667264b9a0300f15503d9 (diff)
Collect and show attachment filenames
Diffstat (limited to 'pgcommitfest/commitfest')
-rw-r--r--pgcommitfest/commitfest/ajax.py3
-rw-r--r--pgcommitfest/commitfest/models.py1
-rw-r--r--pgcommitfest/commitfest/templates/patch.html4
3 files changed, 5 insertions, 3 deletions
diff --git a/pgcommitfest/commitfest/ajax.py b/pgcommitfest/commitfest/ajax.py
index f489d12..92c4575 100644
--- a/pgcommitfest/commitfest/ajax.py
+++ b/pgcommitfest/commitfest/ajax.py
@@ -75,7 +75,8 @@ def parse_and_add_attachments(threadinfo, mailthread):
defaults={
'date': t['date'],
'author': t['from'],
- 'attachmentid': t['atts'][0],
+ 'attachmentid': t['atts'][0]['id'],
+ 'filename': t['atts'][0]['name'],
})
# In theory we should remove objects if they don't have an
# attachment, but how could that ever happen? Ignore for now.
diff --git a/pgcommitfest/commitfest/models.py b/pgcommitfest/commitfest/models.py
index f118bc2..124af72 100644
--- a/pgcommitfest/commitfest/models.py
+++ b/pgcommitfest/commitfest/models.py
@@ -219,6 +219,7 @@ class MailThreadAttachment(models.Model):
mailthread = models.ForeignKey(MailThread, null=False, blank=False)
messageid = models.CharField(max_length=1000, null=False, blank=False)
attachmentid = models.IntegerField(null=False, blank=False)
+ filename = models.CharField(max_length=1000, null=False, blank=True)
date = models.DateTimeField(null=False, blank=False)
author = models.CharField(max_length=500, null=False, blank=False)
ispatch = models.NullBooleanField()
diff --git a/pgcommitfest/commitfest/templates/patch.html b/pgcommitfest/commitfest/templates/patch.html
index 7fcf9fd..97ac9b5 100644
--- a/pgcommitfest/commitfest/templates/patch.html
+++ b/pgcommitfest/commitfest/templates/patch.html
@@ -68,10 +68,10 @@
Latest at <a href="http://www.postgresql.org/message-id/{{t.latestmsgid}}/">{{t.latestmessage}}</a> by {{t.latestauthor|hidemail}}<br/>
{%for ta in t.mailthreadattachment_set.all%}
{%if forloop.first%}
- Latest attachment at <a href="http://www.postgresql.org/message-id/{{ta.messageid}}/">{{ta.date}}</a> from {{ta.author|hidemail}} <button type="button" class="btn btn-default btn-xs" data-toggle="collapse" data-target="#att{{t.pk}}" title="Show all attachments"><i class="glyphicon glyphicon-plus"></i></button>
+ Latest attachment (<a href="http://www.postgresql.org/message-id/attachment/{{ta.attachmentid}}/{{ta.filename}}">{{ta.filename}}</a>) at <a href="http://www.postgresql.org/message-id/{{ta.messageid}}/">{{ta.date}}</a> from {{ta.author|hidemail}} <button type="button" class="btn btn-default btn-xs" data-toggle="collapse" data-target="#att{{t.pk}}" title="Show all attachments"><i class="glyphicon glyphicon-plus"></i></button>
<div id="att{{t.pk}}" class="collapse">
{%endif%}
- &nbsp;&nbsp;&nbsp;&nbsp;Attachment at <a href="http://www.postgresql.org/message-id/{{ta.messageid}}/">{{ta.date}}</a> from {{ta.author|hidemail}} (Patch: {{ta.ispatch|yesno:"Yes,No,Pending check"}})<br/>
+ &nbsp;&nbsp;&nbsp;&nbsp;Attachment (<a href="http://www.postgresql.org/message-id/attachment/{{ta.attachmentid}}/{{ta.filename}}">{{ta.filename}}</a>) at <a href="http://www.postgresql.org/message-id/{{ta.messageid}}/">{{ta.date}}</a> from {{ta.author|hidemail}} (Patch: {{ta.ispatch|yesno:"Yes,No,Pending check"}})<br/>
{%if forloop.last%}</div>{%endif%}
{%endfor%}
</dd>