[PATCH v2 2/6] Remove unnecessary references to Submission model

Stephen Finucane stephen at that.guru
Fri Apr 10 03:12:58 AEST 2020


We want to drop this in future changes. Start by removing any
unnecessary references.

Signed-off-by: Stephen Finucane <stephen at that.guru>
---
 patchwork/admin.py       |  6 ++----
 patchwork/views/cover.py | 10 ++++++----
 patchwork/views/patch.py | 10 ++++++----
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git patchwork/admin.py patchwork/admin.py
index c3d45240..fb798085 100644
--- patchwork/admin.py
+++ patchwork/admin.py
@@ -20,7 +20,6 @@ from patchwork.models import Project
 from patchwork.models import Series
 from patchwork.models import SeriesReference
 from patchwork.models import State
-from patchwork.models import Submission
 from patchwork.models import Tag
 from patchwork.models import UserProfile
 
@@ -76,15 +75,14 @@ class StateAdmin(admin.ModelAdmin):
 admin.site.register(State, StateAdmin)
 
 
-class SubmissionAdmin(admin.ModelAdmin):
+class CoverLetterAdmin(admin.ModelAdmin):
     list_display = ('name', 'submitter', 'project', 'date')
     list_filter = ('project', )
     search_fields = ('name', 'submitter__name', 'submitter__email')
     date_hierarchy = 'date'
 
 
-admin.site.register(Submission, SubmissionAdmin)
-admin.site.register(CoverLetter, SubmissionAdmin)
+admin.site.register(CoverLetter, CoverLetterAdmin)
 
 
 class PatchAdmin(admin.ModelAdmin):
diff --git patchwork/views/cover.py patchwork/views/cover.py
index 54962abb..e90b7373 100644
--- patchwork/views/cover.py
+++ patchwork/views/cover.py
@@ -11,8 +11,8 @@ from django.shortcuts import render
 from django.urls import reverse
 
 from patchwork.models import CoverLetter
+from patchwork.models import Patch
 from patchwork.models import Project
-from patchwork.models import Submission
 from patchwork.views.utils import cover_to_mbox
 
 
@@ -25,9 +25,11 @@ def cover_detail(request, project_id, msgid):
         cover = get_object_or_404(CoverLetter, project_id=project.id,
                                   msgid=db_msgid)
     except Http404 as exc:
-        submissions = Submission.objects.filter(project_id=project.id,
-                                                msgid=db_msgid)
-        if submissions:
+        patches = Patch.objects.filter(
+            project_id=project.id,
+            msgid=db_msgid,
+        )
+        if patches:
             return HttpResponseRedirect(
                 reverse('patch-detail',
                         kwargs={'project_id': project.linkname,
diff --git patchwork/views/patch.py patchwork/views/patch.py
index 470ad197..9fdbbf9b 100644
--- patchwork/views/patch.py
+++ patchwork/views/patch.py
@@ -15,9 +15,9 @@ from django.urls import reverse
 from patchwork.forms import CreateBundleForm
 from patchwork.forms import PatchForm
 from patchwork.models import Bundle
+from patchwork.models import CoverLetter
 from patchwork.models import Patch
 from patchwork.models import Project
-from patchwork.models import Submission
 from patchwork.views import generic_list
 from patchwork.views.utils import patch_to_mbox
 from patchwork.views.utils import series_patch_to_mbox
@@ -42,9 +42,11 @@ def patch_detail(request, project_id, msgid):
     try:
         patch = Patch.objects.get(project_id=project.id, msgid=db_msgid)
     except Patch.DoesNotExist:
-        submissions = Submission.objects.filter(project_id=project.id,
-                                                msgid=db_msgid)
-        if submissions:
+        covers = CoverLetter.objects.filter(
+            project_id=project.id,
+            msgid=db_msgid,
+        )
+        if covers:
             return HttpResponseRedirect(
                 reverse('cover-detail',
                         kwargs={'project_id': project.linkname,
-- 
2.25.2



More information about the Patchwork mailing list