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:
Altimore 2023-03-30 13:32:37 +04:00 committed by GitHub
parent 6b73acc173
commit 1381307c07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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):
""" """