Closed DS1705 closed 1 year ago
@DS1705 I do not really understand how you are trying to achieve your goal. In what kind of plugin (AppMixin, ReportMixin) did you insert this code? How is it loaded? What guide did you follow / where did you copy this code from? It seems logical at first but I do not think it will work this way. In general, we should be able to get this running pretty fast.
https://docs.djangoproject.com/en/4.2/howto/custom-template-tags/ that is what i try to do i updated the code there was something not right
@DS1705 the tag code itself is fine. I just do not see how InvenTree would discover the tag this way. Where did you place this code? In a plugin or in /plugins
?
i found the location i put my tag in report.py in templatetags under report
That is not a very good solution because it makes upgrading much harder because you have to deal with conflicts. You could use an appmixin plugin to define your tags or @matmair what about adding a template tag Mixin?
We have a ReportMixin which is useful for adding custom context data to a report (or label).
Perhaps this mixin could be extended to also add custom methods (tags) which can be called from the template?
A mixin is one possible solution, you could also just use a simple plugin, import the library register of *any templatetag and register your tags against that. in either the init() or the plugin class.
This issue seems stale. Please react to show this is still important.
not stale
This issue seems stale. Please react to show this is still important.
Not stale
Please verify that this feature request has NOT been suggested before.
Problem statement
i wanna use a custom templatetag inside of my label. to display the voltage 0.1V as 100mV the code is below. Is this possible and if it is how do i do it?
`
Suggested solution
i just wan't to know if it is possible
Describe alternatives you've considered
i tried adding the template tag in map templatetags i created in the map of the label app but it didn't work
Examples of other systems
No response
Do you want to develop this?