[Patchew-devel] [PATCH 4/8] rest: create separate results endpoint
Paolo Bonzini
pbonzini at redhat.com
Wed Apr 4 10:03:39 UTC 2018
On 30/03/2018 08:28, Fam Zheng wrote:
>> resource_uri = HyperlinkedMessageField(view_name='series-detail')
>> message = HyperlinkedMessageField(view_name='messages-detail')
>> + results = HyperlinkedMessageField(view_name='results-list', lookup_field='series_message_id')
>
> DRF novice question, why isn't this 'HyperlinkedResultField'?
All that the "HyperlinkedMessageField" is to ensure that reverse() gets
both the project primary key and the message id. The actual URL that is
generated depends on the view_name.
There is a generic subclass of HyperlinkedIdentityField in the
drf-nested-routers package, that would avoid the need for this.
However, I couldn't get it to work. :)
Paolo
More information about the Patchew-devel
mailing list