Open jakubjezek001 opened 1 week ago
@iLLiCiTiT might also have some openion about it?
I agree we need it.
But I just realized that from technical point of view it probably cannot be done with argument in function because project name is filled dynamically from the model, whereas we want to define it for the field.
Ideal usecase are these two options (we can support both).
delivery_template_names_a: list[str] = SettingsField(
default_factory=list,
enum_items=get_anatomy_templates_enum("delivery"),
)
delivery_template_names_b: list[str] = SettingsField(
default_factory=list,
enum_items=anatomy_delivery_templates_enum,
)
def _real_templates_getter(project_name: str | None, category_name: str):
...Implementation of the project anatomy query and getting template names from category
def anatomy_delivery_templates_enum(project_name: str | None = None):
return _real_templates_getter(project_name, "delivery")
...
Other templates category enum methods
...
def get_anatomy_templates_enum(category_name: str):
if category_name == "delivery":
return anatomy_delivery_templates_enum
if category_name == "publish":
...
Current Issue
We currently lack an enumerator for selecting available templates. This would help us avoid potential issues with mistyping text input.
Enhancement Proposal
Let's create another enumerator helper function similar to
link_types_enum
. We could name itanatomy_template_items_enum
. This function should include options for selecting specific template types, likedelivery
, for example. This way, we can easily select only the delivery category of anatomy templates.