diff mbox series

[2/5] Remove unnecessary references to Submission model

Message ID 20200304115457.32300-3-stephen@that.guru
State Superseded
Headers show
Series Remove 'Submission' model | expand

Commit Message

Stephen Finucane March 4, 2020, 11:54 a.m. UTC
We want to drop this in future changes. Start by removing any
unnecessary references.

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

Comments

Andrew Donnellan March 19, 2020, 3:58 a.m. UTC | #1
On 4/3/20 10:54 pm, Stephen Finucane wrote:
> We want to drop this in future changes. Start by removing any
> unnecessary references.

this = Submission model I assume

> 
> Signed-off-by: Stephen Finucane <stephen@that.guru>

This patch needs a trivial rebasing.

Other than that

Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>

> ---
>   patchwork/admin.py       |  6 ++----
>   patchwork/views/cover.py | 10 ++++++----
>   patchwork/views/patch.py | 10 ++++++----
>   3 files changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/patchwork/admin.py b/patchwork/admin.py
> index f9a94c6f..d4ab109c 100644
> --- a/patchwork/admin.py
> +++ b/patchwork/admin.py
> @@ -19,7 +19,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
>   
> @@ -75,15 +74,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 a/patchwork/views/cover.py b/patchwork/views/cover.py
> index 54962abb..e90b7373 100644
> --- a/patchwork/views/cover.py
> +++ b/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 a/patchwork/views/patch.py b/patchwork/views/patch.py
> index f34053ce..bc508bee 100644
> --- a/patchwork/views/patch.py
> +++ b/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 as exc:
> -        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,
>
diff mbox series

Patch

diff --git a/patchwork/admin.py b/patchwork/admin.py
index f9a94c6f..d4ab109c 100644
--- a/patchwork/admin.py
+++ b/patchwork/admin.py
@@ -19,7 +19,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
 
@@ -75,15 +74,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 a/patchwork/views/cover.py b/patchwork/views/cover.py
index 54962abb..e90b7373 100644
--- a/patchwork/views/cover.py
+++ b/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 a/patchwork/views/patch.py b/patchwork/views/patch.py
index f34053ce..bc508bee 100644
--- a/patchwork/views/patch.py
+++ b/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 as exc:
-        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,