From 8aae263a332465d1673ec65c6f2a891b27417d51 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 25 Mar 2016 17:29:30 +0000 Subject: [PATCH] models: Add Cover Letter support Cover letters contain useful information that should not be discarded. Store them. This is a prerequisite of series support. Signed-off-by: Stephen Finucane --- patchwork/admin.py | 6 ++++- .../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 707a3768..0f217d71 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 00000000..ec0f7850 --- /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 9cf2b987..4d454c7b 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -315,6 +315,10 @@ class Submission(EmailMixin, models.Model): unique_together = [('msgid', 'project')] +class CoverLetter(Submission): + pass + + @python_2_unicode_compatible class Patch(Submission): # patch metadata -- 2.47.3