2020-11-25 19:16

Nested Routes

Nested routes are a possible way so solve the problem that we have with button actions. A listing of items of type A would be handled by controller for entity A and not through show_list of entity B.

In controller for entity C that is using the GenericShowMixin we already have display_methods that give the list of entities that we display through nested_list and that is what we need as nested routes below the C. So this can be used to get the list of routes that need to be defined.

The initial work should be done on controller that already use the "generic" mixins and as we refactor more controller we should convert them to use the nested routes.

For example route host/10/instance/5 would be handled by instance_controller. It would display toolbar for instances and there would be no problem with handling the button actions.

Generally all show and show_list would be handled by controller for the entity that is being shown. Unlike now.



  • 点赞
  • 回答
  • 收藏
  • 复制链接分享