You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A call to ProjectResource.get_resource_uri with either api_dispatch_list or api_dispatch_detail returns an empty string, which causes the 'resource_uri' returned with objects on that resource to always be empty strings.
The reason is because in the context of another_project, Django is expecting project:api_dispatch_list and project:api_dispatch_detail. The app_name defined in project.urls needs to be prepended to the view name. So in queries to ProjectResource through another_project, the get_resource_uri method encounters NoReverseMatch and populates 'resource_uri' with an empty string for all objects returned.
In my case, because I manage both projects, my workaround was to override project.api.ProjectResource.get_resource_uri as follows (notice "project:" in the method signature and the first if statement):
Given a project that defines a set of Tastypie endpoints:
project.api
project.urls
And another project that depends on Django 2.2 and that project, which includes the urls defined by it:
another_project.urls
A call to
ProjectResource.get_resource_uri
with eitherapi_dispatch_list
orapi_dispatch_detail
returns an empty string, which causes the'resource_uri'
returned with objects on that resource to always be empty strings.The reason is because in the context of
another_project
, Django is expectingproject:api_dispatch_list
andproject:api_dispatch_detail
. Theapp_name
defined inproject.urls
needs to be prepended to the view name. So in queries toProjectResource
throughanother_project
, theget_resource_uri
method encountersNoReverseMatch
and populates'resource_uri'
with an empty string for all objects returned.In my case, because I manage both projects, my workaround was to override
project.api.ProjectResource.get_resource_uri
as follows (notice"project:"
in the method signature and the firstif
statement):project.api
Can Tastypie be made to better support use cases like the above?
The text was updated successfully, but these errors were encountered: