Skip to content

Controllers should have a url namespace #310

@anentropic

Description

@anentropic

I'm converting some DRF viewsets to Ninja and I want to take advantage of class-based Controllers to have common behaviour (including standard routes) between controllers for different reports

I want to have named urls that can be reversed

But it looks like when I define the routes on the base controller and give them a url_name this is not namespaced to the controller? So I can't give the routes on the base controller url_name as they will clash with each other on the derived controllers

if a controller is expected to have multiple routes (e.g. create, update, detail, list etc) it would make sense that they are namespaced to the controller rather than having to give them globally unique names at point of creation

There is an urls_namespace param on NinjaExtraAPI, so that implies the current solution would be to have an API per controller instead of registering multiple controllers per API?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions