What do I want to achieve, doing a calculation in the DNS template, this will be in plain math:
section_angle = base_angle + (sections_length / current_iteration_counter_over_sections) When it tries to translate it into the projected templates, I think that something like this might happen:
{% section in section%} {%} with base_angle added: section | Length | Splits: divides withloop.counter0 to section_angle%} custom def partition (value, absolute): Returns Float (param) / float (value) I see the bit confused about how to arrange it, using the filter and the logic I should use with the example shown here , It leads to an error: while presenting the captured value: Could not convert string to float:
If you have a background in programming, or if you mix directly the programming code in languages in HTML, then you? Do you want to keep in mind that the Django templates system is not only embedded in Python HTML, it is according to the design: the template system is meant to express the presentation, not program logic.
I think Timmy's comment is correct, keep the whole logic in a custom filter.
No comments:
Post a Comment