On Wednesday, 27 May 2020 13:21:24 UTC+1, ratnadeep ray wrote:
>
> Hi all, 
>
> Currently I am trying to print the type of a variable from the Django 
> template html file as follows: 
>
>     <center><h2>The type of feature list report for version 
>> {%type(version)%} is<h2></center>
>
>
> For the above, I am getting the following error: 
>
> Invalid block tag on line 9: 'type(version)'. Did you forget to register or 
> load this tag?
>
>
> So what's going wrong here? How can we use the python related api's (like 
> type) from the html template files? I think inside the {% .... %} we can 
> use python related evaluations. Am I right? 
>
> Please throw some lights on this .
>
> Thanks. 
>
>
No, you are wrong, and this is explicitly pointed out in the docs 
(https://docs.djangoproject.com/en/3.0/ref/templates/language/):

> bear in mind that the Django template system is not simply Python 
embedded into HTML. This is by design: the template system is meant to 
express presentation, not program logic.

--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0a73190c-06f6-4151-9777-c691d084b8b3%40googlegroups.com.

Reply via email to