From nobody Sat Apr 27 22:40:58 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; 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 1523276510337778.6077384770232; Mon, 9 Apr 2018 05:21:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4F71C80470; Mon, 9 Apr 2018 12:21:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 46391600C2; Mon, 9 Apr 2018 12:21:48 +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 E7AA01808852; Mon, 9 Apr 2018 12:21:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w39CLYQp017661 for ; Mon, 9 Apr 2018 08:21:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id D6FD6215CDC8; Mon, 9 Apr 2018 12:21:34 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-116-32.ams2.redhat.com [10.36.116.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27AA9215CDAF; Mon, 9 Apr 2018 12:21:33 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Mon, 9 Apr 2018 14:21:33 +0200 Message-Id: <20180409122133.8374-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: patchew-devel@redhat.com Cc: Shubham Jain Subject: [Patchew-devel] [PATCH] rest: include URI links for all nested views 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 09 Apr 2018 12:21:49 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" A REST application should in theory not need to build URIs itself; everythi= ng should be reachable from the top page. We are pretty close to that, so do = it right. Signed-off-by: Paolo Bonzini --- api/rest.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/rest.py b/api/rest.py index 3a49e72..381b569 100644 --- a/api/rest.py +++ b/api/rest.py @@ -95,10 +95,15 @@ class ProjectSerializer(serializers.HyperlinkedModelSer= ializer): class Meta: model =3D Project fields =3D ('resource_uri', 'name', 'mailing_list', 'prefix_tags',= 'url', 'git', \ - 'description', 'display_order', 'logo', 'parent_project'= , 'results') + 'description', 'display_order', 'logo', 'parent_project'= , 'messages', + 'results', 'series') =20 + messages =3D HyperlinkedIdentityField(view_name=3D'messages-list', loo= kup_field=3D'pk', + lookup_url_kwarg=3D'projects_pk') results =3D HyperlinkedIdentityField(view_name=3D'results-list', looku= p_field=3D'pk', lookup_url_kwarg=3D'projects_pk') + series =3D HyperlinkedIdentityField(view_name=3D'series-list', lookup_= field=3D'pk', + lookup_url_kwarg=3D'projects_pk') =20 class ProjectsViewSet(viewsets.ModelViewSet): queryset =3D Project.objects.all().order_by('id') --=20 2.16.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel