-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Description
NoResolverMatch
recently-ish added even more helpful context about the failed resolution - paths tried, exact args/kwargs etc. DRF's HyperlinkedRelatedField
replaces it with a generic message that maybe I forgot to hook up a given URL.
DRF:
Could not resolve URL for hyperlinked relationship using view name "foo".
You may have failed to include the related model in your API, or incorrectly
configured the `bar` attribute on this field.
Original exception:
Reverse for 'foo' with arguments '(u'id', 'slug')' and keyword arguments '{}' not found.
1 pattern(s) tried: [u'r/foos/(?P<id>\\d+).(?P<slug>[0-9a-f]+)/$']
In this case the fix was:
reverse('foo', kwargs, request=request)
reverse('foo', kwargs=kwargs, request=request)
Pretty clear from the original exception. If you think that the content in the DRF is useful perhaps concatenate the two, otherwise I think the original exception should be allowed to raise.
I would propose that the entire try/except block at https://github.com/tomchristie/django-rest-framework/blob/68312cb0bc6116eaf4aed18e7ffa01954e888a1f/rest_framework/relations.py#L336-L352 is removed. In particular the second half is redundant with the new Django extensions to the message.