Skip to content

Tough control over what's being added #10

@Mogost

Description

@Mogost

The only one way to control on exposing URLs is JS_REVERSE_EXCLUDE_NAMESPACES.
It's not enough because if you want to add only one URL you should move it to separated namespace and this doesn't looks right. Also when you want share namespace but hide URL.

I think we could try to do more fine-tuned control with a decorator. It could be attached to CBV functions or classes. And on the basis of this additional information at the stage of collection separate the necessary and unnecessary.
Moreover, this style is declarative and makes the control more simple.

def js_reverse(target):
    if isinstance(target, type):
        target.js_reverse = True
        return target

    @wraps(target)
    def wrapper_view(*args, **kwargs):
        return target(*args, **kwargs)

    wrapper_view.js_reverse = True
    return wrapper_view


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions