ellmetha / django-js-routes

Expose and perform reverse lookups of Django URLs in the frontend world.
MIT License
31 stars 6 forks source link

Feature Request: Decorator for implicit export of a view/route #61

Open befocken opened 1 year ago

befocken commented 1 year ago

I think it would be awesome to have a decorator (like @export_route_to_js) that one could add to a view which automatically adds the view (or better all of the routes that it is being connected with) to the exported routes. This way, one does not need to set JS_ROUTES_INCLUSION_LIST manually, though this would of course be easier when exporting all routes of an app.

In relation to #40, the decorator could also get a parameter groups, which adds the routes of this view to the given groups.

Unfortunately, I do not know how to implement this with a decorator as of right now, but I'll possibly have some time to look into that in the future.