From nobody Fri Oct 25 19:26:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521298048989352.664869319652; Sat, 17 Mar 2018 07:47:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1805E4E4C6; Sat, 17 Mar 2018 14:47:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0BDE360BE7; Sat, 17 Mar 2018 14:47:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 033EA4CA98; Sat, 17 Mar 2018 14:47:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HElQBw007071 for ; Sat, 17 Mar 2018 10:47:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8192F183CE; Sat, 17 Mar 2018 14:47:26 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B59860BE7 for ; Sat, 17 Mar 2018 14:47:23 +0000 (UTC) Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C02F7C04AC45 for ; Sat, 17 Mar 2018 14:47:22 +0000 (UTC) Received: by mail-wr0-f196.google.com with SMTP id s10so1487581wra.13 for ; Sat, 17 Mar 2018 07:47:22 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id p12sm7724855wre.89.2018.03.17.07.47.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:47:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=BvB8HeZ11h6rD4WdSFJBCpl6RWPHe9Tos0Ek+Q7dI/Q=; b=KBPQw25P54v3+PED+04Rm1UuGvy3reJhOuBH8qQjQ5l3ceSydDE9l8e5uiGhQ2DoW+ kRFWgHR92+6p9Z7k4GC/I/w0vh+/+lB98QkhQR1IJ/JkLvrP8buN1GG9jIo97ZjypGXY ieyVxfB3m0GBvVw/Ul42oZzrgZwPe/oBSDm28IO8viSbF5yWyL9UPPVcZM7yjZhc9NOY xI9p1a902f5885gvKvdhi1vlzMMKsHkuXzXRI2I8e6MFkXabd/fRGwAyd2gM8sR/r5Tb b1LXfXBWR18REJCS4xg0i5YKeOPV+f6UQGnNnO5HIzwXF7MseKFkOqhZ0b/q4D2iyhf2 6xGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=BvB8HeZ11h6rD4WdSFJBCpl6RWPHe9Tos0Ek+Q7dI/Q=; b=jO/TqAHoRFfXfF+hZ8Lyroarme1Uz8uyHbX9RwLc1kwA6ox9ll6uN9zvJx/LnFuwTu xo0TKpokV1TJTLwlQGzKk+q04A9F54MkfXsfkovm8/CRGGPQL6Fjsrp20AQd+sa/4yDF LLD6/hH1BKDpgB0WEUsEz5Dx916yYo1HihoRLk/se4TW9t1CD8Z30eWLLJEmXGvvo+Nl 6CfElNg8xvyHV02eYIN57oxkg9tvDS6d6L81QgUHLMb4sOYC166IH+Xm4Qz9qpOC6vgd O6euBuwexOsVljDoOxi8GnvMoXTDt1wYnJJkm69MoPWAX/QOr0MJ2JhQJOV7L4+ogiB4 DsFA== X-Gm-Message-State: AElRT7EZqP3F9w5EuOtJmLWzco4sOhrjNEHXCcOsqCSz+y5VQxgp8d6Z UrtT0NgQ9mfmpSCTVC8cMVYoYt8F X-Google-Smtp-Source: AG47ELveEZoCYZnVG+Zw4PaDxniy0T+JbIF+UQubg8oF/Wg760hzXJq/SqCo9n7Se2pluwRQJhstUg== X-Received: by 10.223.226.14 with SMTP id j14mr4480753wri.17.1521298041122; Sat, 17 Mar 2018 07:47:21 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Sat, 17 Mar 2018 15:47:12 +0100 Message-Id: <20180317144714.18268-4-pbonzini@redhat.com> In-Reply-To: <20180317144714.18268-1-pbonzini@redhat.com> References: <20180317144714.18268-1-pbonzini@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 17 Mar 2018 14:47:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 17 Mar 2018 14:47:22 +0000 (UTC) for IP:'209.85.128.196' DOMAIN:'mail-wr0-f196.google.com' HELO:'mail-wr0-f196.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.487 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.128.196 mail-wr0-f196.google.com 209.85.128.196 mail-wr0-f196.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: patchew-devel@redhat.com Cc: Shubham Jain Subject: [Patchew-devel] [PATCH 3/5] rest: use lookup_field in HyperlinkedMessageField X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 17 Mar 2018 14:47:28 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Allow overriding the lookup field, so that it can be used with views that a= re not based on BaseMessageViewSet. The next patch will use it to include the= URI for results. Signed-off-by: Paolo Bonzini --- api/rest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/rest.py b/api/rest.py index 0bb3c30..7df7618 100644 --- a/api/rest.py +++ b/api/rest.py @@ -101,8 +101,9 @@ class ProjectsViewSet(viewsets.ModelViewSet): # Common classes for series and messages =20 class HyperlinkedMessageField(HyperlinkedIdentityField): + lookup_field =3D 'message_id' def get_url(self, obj, view_name, request, format): - kwargs =3D {'projects_pk': obj.project_id, 'message_id': obj.messa= ge_id} + kwargs =3D {'projects_pk': obj.project_id, self.lookup_field: obj.= message_id} return self.reverse(view_name, kwargs=3Dkwargs, request=3Drequest,= format=3Dformat) =20 class BaseMessageSerializer(serializers.ModelSerializer): --=20 2.16.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel