@@ -192,7 +192,7 @@ table.patchmeta tr th, table.patchmeta tr td {
vertical-align: top;
}
-.patchrelations ul {
+.patchgroup ul {
list-style-type: none;
padding: 0;
margin: 0;
new file mode 100644
@@ -0,0 +1,28 @@
+# Generated by Django 2.2.3 on 2019-09-05 18:07
+
+import datetime
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+import patchwork.models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('patchwork', '0036_project_commit_url_format'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='PatchRelation',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ],
+ ),
+ migrations.AddField(
+ model_name='patch',
+ name='related',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='patches', related_query_name='patch', to='patchwork.PatchRelation'),
+ ),
+ ]
@@ -436,6 +436,12 @@ class Patch(Submission):
default=None, null=True,
help_text='The number assigned to this patch in the series')
+ # related patches metadata
+
+ related = models.ForeignKey(
+ 'PatchRelation', null=True, blank=True, on_delete=models.SET_NULL,
+ related_name='patches', related_query_name='patch')
+
objects = PatchManager()
@staticmethod
@@ -832,6 +838,13 @@ class BundlePatch(models.Model):
ordering = ['order']
+class PatchRelation(models.Model):
+
+ def __str__(self):
+ return ', '.join(patch.name for patch in self.patches.all()) or \
+ '<Empty>'
+
+
@python_2_unicode_compatible
class Check(models.Model):
@@ -72,18 +72,12 @@ function toggle_div(link_id, headers_id)
<tr>
<th>Series</th>
<td>
- <a href="{% url 'patch-list' project_id=project.linkname %}?series={{ submission.series.id }}">
- {{ submission.series }}
- </a>
- </td>
- </tr>
- <tr>
- <th>Related</th>
- <td>
- <a id="togglepatchrelations"
- href="javascript:toggle_div('togglepatchrelations', 'patchrelations')"
- >show</a>
- <div id="patchrelations" class="patchrelations" style="display:none;">
+ <span style="width: 35px; display: inline-block">
+ <a id="togglepatchseries"
+ href="javascript:toggle_div('togglepatchseries', 'patchseries')"
+ >show</a>
+ </span> {{ submission.series }}
+ <div id="patchseries" class="patchgroup" style="display:none;">
<ul>
{% with submission.series.cover_letter as cover %}
<li>
@@ -110,6 +104,35 @@ function toggle_div(link_id, headers_id)
</li>
{% endfor %}
</ul>
+ <a style="margin-top: 4px; display: inline-block"
+ href="{% url 'patch-list' project_id=project.linkname %}?series={{ submission.series.id }}"
+ >Overview</a>
+ </div>
+ </td>
+ </tr>
+{% endif %}
+{% if submission.related %}
+ <tr>
+ <th>Related</th>
+ <td>
+ <a id="togglepatchrelations"
+ href="javascript:toggle_div('togglepatchrelations', 'patchrelations')"
+ >show</a>
+ <div id="patchrelations" class="patchgroup" style="display:none;">
+ <ul>
+ {% for sibling in submission.related.patches.all %}
+ <li>
+ {% if sibling != submission %}
+ <a href="{% url 'patch-detail' patch_id=sibling.id %}">
+ {{ sibling.name|default:"[no subject]"|truncatechars:100 }}
+ </a>
+ {% if sibling.project != submission.project %}
+ (in {{ sibling.project }})
+ {% endif %}
+ {% endif %}
+ </li>
+ {% endfor %}
+ </ul>
</div>
</td>
</tr>