From patchwork Tue Jul 30 21:05:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Hassick X-Patchwork-Id: 1966759 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=iol.unh.edu header.i=@iol.unh.edu header.a=rsa-sha256 header.s=unh-iol header.b=PERb84ct; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WYSR265jSz1ybb for ; Wed, 31 Jul 2024 07:04:46 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=iol.unh.edu header.i=@iol.unh.edu header.a=rsa-sha256 header.s=unh-iol header.b=PERb84ct; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4WYSR254rcz3d8t for ; Wed, 31 Jul 2024 07:04:46 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=iol.unh.edu Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=iol.unh.edu header.i=@iol.unh.edu header.a=rsa-sha256 header.s=unh-iol header.b=PERb84ct; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=iol.unh.edu (client-ip=2607:f8b0:4864:20::32e; helo=mail-ot1-x32e.google.com; envelope-from=ahassick@iol.unh.edu; receiver=lists.ozlabs.org) Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4WYSQl3f09z3d2S for ; Wed, 31 Jul 2024 07:04:31 +1000 (AEST) Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-70930f8eabbso2003156a34.1 for ; Tue, 30 Jul 2024 14:04:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1722373468; x=1722978268; darn=lists.ozlabs.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ar47M7o6nrdY9gBB4pfYuwqRRqVcA74VS9+qKUcqIYY=; b=PERb84ctSv+JytTPQPM00CmjIkdytVyj7BIVKWER/TY8iLOGrMK0xgENAMfJu2ruVs Tu66zbw25CxlcQPPnuMn73GE90qbPpgexa02x5cpwhw41evwIXdXvn8XgL/W1L0eHk6o 792GbsfQOVYx8EW9cy67knUeherJ4JrAWlg3Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722373468; x=1722978268; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ar47M7o6nrdY9gBB4pfYuwqRRqVcA74VS9+qKUcqIYY=; b=cxiX73EmTus6wpiGyClIy6geOG4Tl3TPJKkVPg6be3m9MiF8R42F3zKBPoYCUqtfAj iy1Kio/ALRM9o3E+rLnY/7Byqw9Vt7uyVAEB4ag5CNe5QJGVbs/M9RbZsTW37XRoaJVs kHCH9K98eG9Jyet7wSE1Ugtxk+zsgDSf26gblo1Gvq1RwSrRe6vF3vbOt7XOEMTjmD2c WSJkDWA4QpK1jsbr/c4vc9e0Wg9Lw5n0V9e9O6uksVUEuiWlPl2OqAO+XjrA1+/NYZti ql3bLO80ujFxI+3EuDTREl3NyVd/iMK8pfTf4+5lC+d/JW2FHHgR3Swe0rn9Qd9JWH5a YkhA== X-Gm-Message-State: AOJu0Yyjh6i0zr4PFdvOwB6e5xLR7MOxRBdkgWxTC/5uv6DyhlSeCtgG +u0myLem/bjrYTE9rjnnN1IYXXpTeXqMx47FbbFpaTijS6QBAw6hGcAAHkKC1l+c1RaWU4RaLNb iC44WRAVNV9C/TjYFgj/HLJOyosgqpAUWGNM27l87ww9BDaLOu6ht2YYfHFDeeSo4v6iPPbpCRl ixO+3NgubV1WQQdfzoTk1cfieee1cmgRTXE+Qp8REUdf0Dfw== X-Google-Smtp-Source: AGHT+IFZyyu1yynAquv+dUFLOwrpUU52CfewlvKSVxuxYVCP5o0kGdb2Rj2HzVOTEycSOrQr7z/Zag== X-Received: by 2002:a05:6358:93aa:b0:1ad:10ff:341c with SMTP id e5c5f4694b2df-1adce4642b3mr1850447055d.24.1722373468335; Tue, 30 Jul 2024 14:04:28 -0700 (PDT) Received: from bubs.iol.unh.edu ([2606:4100:3880:1271:27d2:9af4:4b7f:fdb5]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bb3f8dc20fsm67411046d6.4.2024.07.30.14.04.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 14:04:28 -0700 (PDT) From: Adam Hassick To: patchwork@lists.ozlabs.org Subject: [PATCH v2 2/7] api: Add fields to series detail view Date: Tue, 30 Jul 2024 17:05:16 -0400 Message-ID: <20240730210523.313101-3-ahassick@iol.unh.edu> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730210523.313101-1-ahassick@iol.unh.edu> References: <20240730210523.313101-1-ahassick@iol.unh.edu> MIME-Version: 1.0 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" Adds the "dependencies" and "dependents" fields to the series detail view. Signed-off-by: Adam Hassick Reviewed-by: Stephen Finucane --- patchwork/api/series.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/patchwork/api/series.py b/patchwork/api/series.py index b88ed1f..2b23e48 100644 --- a/patchwork/api/series.py +++ b/patchwork/api/series.py @@ -5,7 +5,10 @@ from rest_framework.generics import ListAPIView from rest_framework.generics import RetrieveAPIView -from rest_framework.serializers import SerializerMethodField +from rest_framework.serializers import ( + SerializerMethodField, + HyperlinkedRelatedField, +) from patchwork.api.base import BaseHyperlinkedModelSerializer from patchwork.api.base import PatchworkPermission @@ -24,6 +27,12 @@ class SeriesSerializer(BaseHyperlinkedModelSerializer): mbox = SerializerMethodField() cover_letter = CoverSerializer(read_only=True) patches = PatchSerializer(read_only=True, many=True) + dependencies = HyperlinkedRelatedField( + read_only=True, view_name='api-series-detail', many=True + ) + dependents = HyperlinkedRelatedField( + read_only=True, view_name='api-series-detail', many=True + ) def get_web_url(self, instance): request = self.context.get('request') @@ -50,6 +59,8 @@ class SeriesSerializer(BaseHyperlinkedModelSerializer): 'mbox', 'cover_letter', 'patches', + 'dependencies', + 'dependents', ) read_only_fields = ( 'date', @@ -60,9 +71,15 @@ class SeriesSerializer(BaseHyperlinkedModelSerializer): 'mbox', 'cover_letter', 'patches', + 'dependencies', + 'dependents', ) versioned_fields = { '1.1': ('web_url',), + '1.4': ( + 'dependencies', + 'dependents', + ), } extra_kwargs = { 'url': {'view_name': 'api-series-detail'}, @@ -76,7 +93,12 @@ class SeriesMixin(object): def get_queryset(self): return ( Series.objects.all() - .prefetch_related('patches__project', 'cover_letter__project') + .prefetch_related( + 'patches__project', + 'cover_letter__project', + 'dependencies', + 'dependents', + ) .select_related('submitter', 'project') )