[Answer]-How to check for a value's datatype inside django template?

1👍

✅

the “|date” you see is called a template filter and is a built-in function of django

you may want to create one of your own (here’s how) that takes something as input and returns its datatype.

but, imo, it’s not a best-practice, since a template should mostly be used to just display and format data. if you need an evaluation on the type i suggest you move that inside a view and return the result in the context, eventually

Leave a comment