Commit 7fb2149c authored by Damien Lespiau's avatar Damien Lespiau
Browse files

patch: Single out the commit message



All 'Comments' are stored the same way in the db, but I believe it's
worth making the distinction between introducing what the patch does and
eventual review comments.

v2: Use two new Patch methods to retrieve the commit message and the
    other comments (called answers here) (Jeremy Kerr)
Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
parent 91961981
......@@ -18,6 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.db import models
from django.db.models import Q
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.contrib.sites.models import Site
......@@ -257,7 +258,17 @@ class Patch(models.Model):
def __unicode__(self):
return self.name
def commit_message(self):
"""Retrieves the commit message"""
return Comment.objects.filter(patch=self, msgid=self.msgid)
def answers(self):
"""Retrieves the answers (ie all comments but the commit message)"""
return Comment.objects.filter(Q(patch=self) & ~Q(msgid=self.msgid))
def comments(self):
"""Retrieves all comments of this patch ie. the commit message and the
answers"""
return Comment.objects.filter(patch = self)
def _set_tag(self, tag, count):
......
......@@ -177,12 +177,25 @@ function toggle_headers(link_id, headers_id)
>{{ patch.pull_url }}</a>
{% endif %}
{% for item in patch.commit_message %}
<h2>Commit Message</h2>
<div class="comment">
<div class="meta">{{ item.submitter|personify:project }} - {{item.date}}</div>
<pre class="content">
{{ item|commentsyntax }}
</pre>
</div>
{% endfor %}
{% for item in patch.answers %}
{% if forloop.first %}
<h2>Comments</h2>
{% for comment in patch.comments %}
{% endif %}
<div class="comment">
<div class="meta">{{ comment.submitter|personify:project }} - {{comment.date}}</div>
<div class="meta">{{ item.submitter|personify:project }} - {{item.date}}</div>
<pre class="content">
{{ comment|commentsyntax }}
{{ item|commentsyntax }}
</pre>
</div>
{% endfor %}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment