From patchwork Sun Oct 14 12:45:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 983720 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42Y1c03BpPz9s8F for ; Sun, 14 Oct 2018 23:49:20 +1100 (AEDT) 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" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="kDMo00o7"; 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 42Y1c01kk3zF3Bd for ; Sun, 14 Oct 2018 23:49:20 +1100 (AEDT) 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" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="kDMo00o7"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.2; helo=relay-direct2.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" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="kDMo00o7"; dkim-atps=neutral Received: from relay-direct2.mxroute.com (relay-direct2.mxroute.com [185.234.75.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42Y1YR3qF1zDsRY for ; Sun, 14 Oct 2018 23:47:07 +1100 (AEDT) Received: from filter002.mxroute.com (unknown [185.133.192.179]) by relay-direct2.mxroute.com (Postfix) with ESMTP id 2EC193F0E0; Sun, 14 Oct 2018 12:46:35 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id 139EE3F53E; Sun, 14 Oct 2018 12:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: 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=OqOD0xw3EcZRQD9FHimioLUbg/vxgawV/LPw/CEHJow=; b=kDMo00o7JF9kcUmqUbogSS5cZG 8PG4o2k/TuOuK6L0leZhkGyD/zIgJo7RxmyQbJE1v47nSEUAMo/8daBLOjEB74DGAbeMzA07dB/oJ qoMmUFuCJ5TAzs2JyBES9lHkjMyzBgJgJ7r9AF76vnKLtvBVLpkF5YrHNAJAhcSRSp+QPldHDovwy AS8Td5/AOUWSSdkPOn0hVvVm5UXHlzLP9N5Axi89/jZQokaClDkwnFpSWAlbAaPkmJ01NYVkmDy9Y OjfeeXg6mqTKXw1rPwBWN3kmigWD80VKH/f9ML/xNQJ71zYNYgqeTt9HOYDS211fOArWi0e8VDU02 TfplxtSQ==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH v2 06/10] admin: Add label views Date: Sun, 14 Oct 2018 13:45:37 +0100 Message-Id: <20181014124541.13393-7-stephen@that.guru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181014124541.13393-1-stephen@that.guru> References: <20181014124541.13393-1-stephen@that.guru> 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: , Cc: mpe@ellerman.id.au, andrew.donnellan@au1.ibm.com MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" There are two added: a general labels view that includes both project and non-project labels, and an inline labels view that's part of the project. Signed-off-by: Stephen Finucane --- v2: - Only show labels that are not associated with a project for the label admin view - Add 'project' to list view --- patchwork/admin.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/patchwork/admin.py b/patchwork/admin.py index 0e9ccfa7..31103106 100644 --- a/patchwork/admin.py +++ b/patchwork/admin.py @@ -12,6 +12,7 @@ from patchwork.models import Check from patchwork.models import Comment from patchwork.models import CoverLetter from patchwork.models import DelegationRule +from patchwork.models import Label from patchwork.models import Patch from patchwork.models import Person from patchwork.models import Project @@ -38,10 +39,16 @@ class DelegationRuleInline(admin.TabularInline): fields = ('path', 'user', 'priority') +class LabelInline(admin.TabularInline): + model = Label + fields = ('name', 'description', 'color') + + class ProjectAdmin(admin.ModelAdmin): list_display = ('name', 'linkname', 'listid', 'listemail') inlines = [ DelegationRuleInline, + LabelInline, ] @@ -71,6 +78,7 @@ class SubmissionAdmin(admin.ModelAdmin): class PatchAdmin(admin.ModelAdmin): list_display = ('name', 'submitter', 'project', 'state', 'date', 'archived', 'is_pull_request') + readonly_fields = ('labels',) list_filter = ('project', 'state', 'archived') list_select_related = ('submitter', 'project', 'state') search_fields = ('name', 'submitter__name', 'submitter__email') @@ -134,6 +142,14 @@ class TagAdmin(admin.ModelAdmin): list_display = ('name',) +class LabelAdmin(admin.ModelAdmin): + list_display = ('name', 'color') + + def get_queryset(self, request): + qs = super(LabelAdmin, self).get_queryset(request) + return qs.filter(project=None) + + admin.site.unregister(User) admin.site.register(User, UserAdmin) admin.site.register(Project, ProjectAdmin) @@ -148,3 +164,4 @@ admin.site.register(SeriesReference, SeriesReferenceAdmin) admin.site.register(Check, CheckAdmin) admin.site.register(Bundle, BundleAdmin) admin.site.register(Tag, TagAdmin) +admin.site.register(Label, LabelAdmin)