From patchwork Thu Apr 9 17:12:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 1268692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48ynmR0jgyz9sSk for ; Fri, 10 Apr 2020 03:13:43 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" header.d=that.guru header.i=@that.guru header.a=rsa-sha256 header.s=default header.b=rOY2KVyk; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48ynmQ5fvXzDqg9 for ; Fri, 10 Apr 2020 03:13:42 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=that.guru (client-ip=45.152.178.121; helo=chi01-121.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" header.d=that.guru header.i=@that.guru header.a=rsa-sha256 header.s=default header.b=rOY2KVyk; dkim-atps=neutral Received: from chi01-121.mxroute.com (chi01-121.mxroute.com [45.152.178.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48ynly46W0zDqPQ for ; Fri, 10 Apr 2020 03:13:18 +1000 (AEST) Received: from filter004.mxroute.com ([149.28.56.236] 149.28.56.236.vultr.com) (Authenticated sender: mN4UYu2MZsgR) by chi01-121.mxroute.com (ZoneMTA) with ESMTPSA id 1715fee71520001c89.001 for (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Thu, 09 Apr 2020 17:13:14 +0000 X-Zone-Loop: 94804585dca1aa5ff6ba5194fb5555a5fb4ca2e1a657 X-Originating-IP: [149.28.56.236] Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter004.mxroute.com (Postfix) with ESMTPS id 92A953EACB for ; Thu, 9 Apr 2020 17:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=CJtLr6m4thFqJi5ytgr/SHlCDq8KJ7Iu+lU4T2Krq+Y=; b=rOY2KVykckIV3XlpqHMn/rcRVr sq3RyRR/1I83ELSboafC4t1SlytQx7zwGtjdbL4G2mevQ+tG9ky+d8n41PDmKMTheVvmRJipyypbN MPYgkbJsqemSdKHGb6OgFojw29MHlel+StRf7j3uJkprtNCHqzlonFokC2WVgc3W8BJj2VX14D6Ky IKmJWCcX1eZ78htV2v4RBUlelFFCPKHylCnUVPevVlgy/YF70Xg4ZMUPJ9r4ua7kmNEH5zKGnzpoW ai0/NI6wOhKHp3gnCm1vzK7z3ZhK21ewd/5if4Q2mQEhjqxQldSVKvhYrDSFXh/80N+1FkGgUDm/d L6SgNJlA==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH v2 2/6] Remove unnecessary references to Submission model Date: Thu, 9 Apr 2020 18:12:58 +0100 Message-Id: <20200409171302.105869-3-stephen@that.guru> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200409171302.105869-1-stephen@that.guru> References: <20200409171302.105869-1-stephen@that.guru> MIME-Version: 1.0 X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" We want to drop this in future changes. Start by removing any unnecessary references. Signed-off-by: Stephen Finucane --- 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,