So I have a base.html
template and a review_result.html
template that extends the base.html
template. The base.html
template has a script tag with lots of function. I am going to move a function called format
from a script tag in the review_result.html
to the base.html
file. How do I then call the format
function in review_result.html
from base.html
?
Asked
Active
Viewed 239 times
0

TritonKid
- 1
- 1
-
What do you mean when you say your `base.html` _has_ a script tag? Generally speaking, _templates_ do not contain function code or tags. Available tags are either builtin or controlled by your site configuration or loaded in using `{% load %}` -- in any case, they are not _inside_ your templates, exactly. See [custom template tags](https://docs.djangoproject.com/en/3.2/howto/custom-template-tags/). Also, does this answer your question: [Is it possible to load a custom template tag in base and use it in extented templates](https://stackoverflow.com/q/20560222/5747944) ? – sytech Nov 30 '21 at 02:30
-
Hey there, welcomne to SO. It's a good question but could you edit your post and add any code that you have tried? It will definitely help any answers. – Cutey from Cute Code Dec 04 '21 at 16:52