No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

show_object.html 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <!-- Produce a <li></li> with objects informations -->
  2. {% macro object_ul(leo, max_depth = 0, exclude = []) -%}
  3. <ul>
  4. {% if max_depth <= 0 %}
  5. <!-- No need to go deeper -->
  6. {% for fname, fvalue in leo.datas(True).items() %}
  7. <li><em>{{ fname }}</em> : {{fvalue}}</li>
  8. {%endfor%}
  9. {% else %}
  10. {% for fname in leo.fieldnames(True) %}
  11. {% set fvalue = leo.data(fname) %}
  12. {% set fdh = leo.data_handler(fname) %}
  13. {% if fvalue is not none and fdh.is_reference() %}
  14. {% if fdh.is_singlereference() %}
  15. {% set referenced = fdh.get_referenced(fvalue) %}
  16. {% if (referenced.__class__.__name__, referenced.uid) in exclude %}
  17. <li><em>{{fname}}</em> : {{fvalue}}</li>
  18. {% else %}
  19. <li><em>{{fname}}</em> : {{object_ul(referenced, max_depth - 1, exclude + [(leo.__class__.__name__, leo.uid())] )}}</li>
  20. {% endif %}
  21. {% else %}
  22. <li><em>{{fname}}</em> : <ul>
  23. {% for referenced in fdh.get_referenced(fvalue) %}
  24. {% if (referenced.__class__.__name__, referenced.uid) in exclude %}
  25. <li><em>{{fname}}</em> : {{fvalue}}</li>
  26. {% else %}
  27. <li><em>{{fname}}</em> : {{object_ul(referenced, max_depth - 1, exclude + [(leo.__class__.__name__, leo.uid())] )}}</li>
  28. {% endif %}
  29. {% endfor %}
  30. </ul></li>
  31. {% endif %}
  32. {% else %}
  33. <li><em>{{fname}}</em> : {{fvalue}}</li>
  34. {% endif %}
  35. {% endfor %}
  36. {% endif %}
  37. </ul>
  38. {%- endmacro %}