[PATCH 2/5] Remove unnecessary references to Submission model

Andrew Donnellan ajd at linux.ibm.com
Thu Mar 19 14:58:22 AEDT 2020


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 at that.guru>

This patch needs a trivial rebasing.

Other than that

Reviewed-by: Andrew Donnellan <ajd at 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,
> 

-- 
Andrew Donnellan              OzLabs, ADL Canberra
ajd at linux.ibm.com             IBM Australia Limited



More information about the Patchwork mailing list