[PATCH 03/13] models: Add Cover Letter support

Stephen Finucane stephen.finucane at intel.com
Fri Mar 11 23:08:07 AEDT 2016


Cover letters contain useful information that should not be discarded.
Store them.

This is a prerequisite of series support.

Signed-off-by: Stephen Finucane <stephen.finucane at intel.com>
---
 patchwork/admin.py                                 |  6 +++++-
 patchwork/migrations/0012_add_coverletter_model.py | 24 ++++++++++++++++++++++
 patchwork/models.py                                |  4 ++++
 3 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 patchwork/migrations/0012_add_coverletter_model.py

diff --git a/patchwork/admin.py b/patchwork/admin.py
index 707a376..0f217d7 100644
--- a/patchwork/admin.py
+++ b/patchwork/admin.py
@@ -22,7 +22,7 @@ from __future__ import absolute_import
 from django.contrib import admin
 
 from patchwork.models import (Project, Person, UserProfile, State, Submission,
-                              Patch, Comment, Bundle, Tag, Check,
+                              Patch, CoverLetter, Comment, Bundle, Tag, Check,
                               DelegationRule)
 
 
@@ -70,6 +70,10 @@ class SubmissionAdmin(admin.ModelAdmin):
 admin.site.register(Submission, SubmissionAdmin)
 
 
+CoverLetterAdmin = SubmissionAdmin
+admin.site.register(CoverLetter, CoverLetterAdmin)
+
+
 class PatchAdmin(admin.ModelAdmin):
     list_display = ('name', 'submitter', 'project', 'state', 'date',
                     'archived', 'is_pull_request')
diff --git a/patchwork/migrations/0012_add_coverletter_model.py b/patchwork/migrations/0012_add_coverletter_model.py
new file mode 100644
index 0000000..ec0f785
--- /dev/null
+++ b/patchwork/migrations/0012_add_coverletter_model.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('patchwork', '0011_remove_temp_fields'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='CoverLetter',
+            fields=[
+                ('submission_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='patchwork.Submission')),
+            ],
+            options={
+                'abstract': False,
+            },
+            bases=('patchwork.submission',),
+        ),
+    ]
diff --git a/patchwork/models.py b/patchwork/models.py
index 3eacebf..f0ce73f 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -355,6 +355,10 @@ class Submission(EmailMixin, models.Model):
         unique_together = [('msgid', 'project')]
 
 
+class CoverLetter(Submission):
+    pass
+
+
 @python_2_unicode_compatible
 class Patch(Submission):
     # patch metadata
-- 
2.0.0



More information about the Patchwork mailing list