Skip to content

Conversation

@jcougnaud
Copy link
Contributor

No description provided.

@jcougnaud jcougnaud force-pushed the feature/OS-1729 branch 5 times, most recently from b461fc1 to 8aef431 Compare January 22, 2026 16:42


@register.filter
def get_attr(obj, attribute):
Copy link
Contributor

@BenJneB BenJneB Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je pense que tu peux mettre ceci dans base.templatetags.getattr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En fait, je ne savais pas que ce filtre existait déjà mais je pense que je peux le reprendre directement ici, cela évitera de créer un nouveau filtre assez proche.



@register.filter
def get_item(dictionary, value):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

et ceci dans base.templatetags.dictionnar

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ce serait une bonne idée effectivement mais l'inconvénient est qu'on a déjà un filtre appelé de la même manière dans base.templatetags.dictionnary qui ne fait pas la même chose (celui dans admission renvoie la clé par défaut, celui dans base retourne None). Que préfères-tu qu'on fasse ici ?



@register.filter
def get_item(dictionary, value):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@register.filter
def get_item(dictionary, key, value=None):
    return dictionary.get(key, value)

Si on fait ca dans base; cela serait pas ok?
et toi tu devrais l'appeler ainsi get_item key key ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je ne suis pas sûr qu'on puisse passer 3 arguments à un filtre. Ou alors il faudrait utiliser un simple_tag (comme admission.templatetags.admission.get_item_or_default) ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fais au plus simple :) on peux laisser en 'létat du coup

Base automatically changed from feature/OS-1693 to dev January 29, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants