mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-23 22:49:50 +03:00
fix: double namespace
When using namespaces on my apps and django generic relation project i get a double name space : in relations.py i added this print statement on the line 383 before the matching viewname test ``` print( f"Comparing '{match.view_name}' to '{expected_viewname}', self.view_name = {self.view_name} " ) ``` and this is what i get in the console ``` Comparing invoices:invoice-detail to reminders:invoices:invoice-detail, self.view_name = invoices:invoice-detail ``` so i just added a test in def get_versioned_viewname(self, viewname, request): to not change the view name i there is already a namespace.
This commit is contained in:
parent
6b73acc173
commit
1381307c07
|
@ -135,8 +135,10 @@ class NamespaceVersioning(BaseVersioning):
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_versioned_viewname(self, viewname, request):
|
def get_versioned_viewname(self, viewname, request):
|
||||||
return request.version + ':' + viewname
|
if not ":" in viewname:
|
||||||
|
return request.version + ":" + viewname
|
||||||
|
else:
|
||||||
|
return viewname
|
||||||
|
|
||||||
class HostNameVersioning(BaseVersioning):
|
class HostNameVersioning(BaseVersioning):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user