How to implement U61 for entities with no designer

Previously you would specify the label / children etc in the manifest, however this is now done in the controller.
I have 2 entities that essentially work as folders. they dont have a designer/ editor.
Thus they have no folder in the code structure and no controller.
Where should i specify the label without getting the following warning:

WARNING : /usr/local/lib/python3.7/multiprocessing/ DeprecationWarning: app.user_manual.controller.Controller: 'label' is not defined as class attribute. Entity-type information should be defined on the Controller instead of the manifest in the future

Hi Natalie,

Did you know an automated code fix is available for this upgrade? See SDK - Upgrades | VIKTOR Documentation for more information. The fix can be applied with:

viktor-cli.exe fix APP -u 61

I think your case should be handled by this code fix.

However, if it doesn’t update your code correctly you can do the following in your codebase:

  1. Add a folder app/folder_entity that contains the following files:
  2. Add the following code to app/folder_entity/
from viktor.core import ViktorController
from viktor.views import Summary

class FolderEntityController(ViktorController):
    label = 'Folder Entity' # put the correct label here
    summary = Summary()
    children = ['Child1']   # put the correct child entities here
    show_children_as = 'Table'
  1. Add the following line to app/
from .folder_entity.controller import FolderEntityController

You are free to change the name folder_entity here of course:)

i thought that might be the case, that i need to add a folder and controller, just wondered if it could be avoided.
I tried the fix, but it didnt work for me, probably because currently no controller exists.
thanks for the help

Did you already change something in the manifest (e.g. deleting the label) before applying the fix?

no i didnt touch the items that didnt have a designer as then it wouldnt be specified anywhere.

though i notice the warning is related to the usermanual which i had not changed at that point.
Does that suggest that i could leave the folder entities to be specified in the manifest and anything with a controller to be specified in the controller?

No all entity-types should have a Controller in the future, because we want to move away from the manifest completely. If it only has a “folder” function, the controller can be as simple as Raoul suggests (from v12.6.0 Summary can be removed as well).

1 Like

to add a bit in this discussion: the SDK does not require you to have a folder for each entitytype, you are free to add the Controller directly in app/, but this might be more difficult to read for others accessing your code. more on this here: Tree type apps | VIKTOR Documentation