Anonymous
how to write len() function in djnago template tag?
Mirco
move the code into the view - first suggestion
Mirco
second - it exists the length template filter
Rhythm
means?
Write the code in the views instead of template
Mirco
means?
it means don't write too much logic into the template as it's the presentation layer
Mirco
move the business logic into models/views
Anonymous
Write the code in the views instead of template
but I am want to access that code at client side
Anonymous
move the business logic into models/views
ok , I will try and other way
Mirco
but I am want to access that code at client side
we are suggesting you the best practices but I've also told you about template filter length
Mirco
just check it out on official docs
Anonymous
like length filter
Anonymous
ok , thanks buddy
Mirco
!yw
Doragonsureiyā
You're welcome! 😊
Anonymous
Anonymous
can i call javascript function inside template tag?
Mirco
what r u trying to do ?
Anonymous
it very difficult me for describe in verbly
Anonymous
can I send pic here?
Mirco
no
Mirco
!rules
Doragonsureiyā
Read the rules before any activity: @PythonRules
Anonymous
no
ok tell me can I use var like i in template
Mirco
apart the code what's your goal ?
.
What's django
Anonymous
What's django
https://hastebin.com/guvatuwoja.cs
Anonymous
see my code
Anonymous
in that I need to add td tag with select option after inner for loop complete
Mirco
Doragonsureiyā
What's django
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Mirco
ah you mean on click one of the option ?
Anonymous
and what do you wanna do with js ?
I am wrong , I am thinking that with one extra variable my work will be done
Mirco
if you wanna handle on click of option you have lots of ways also with js to select the option by matching the name attribute or just add an id attribute
Anonymous
ah you mean on click one of the option ?
i am just want to create one td if my first if condition true other wise I run inner for loop still it done and then add td
Anonymous
that why I need extra var for keep record if my if codition true or not
Anonymous
I hope you got my doubt
Anonymous
u can check it directly without using a var
but that i don't need because see my code if I do that then other extra thing will be print
Xavier
and if you want to do that then go {% with apple=conditions %}...{% endwith %}
Anonymous
because of inner for loop
Anonymous
during run time like 0 or 1?
Anonymous
and if you want to do that then go {% with apple=conditions %}...{% endwith %}
can I change apple variable during runing of for loop like 0 or 1
Xavier
hello
wait checking that
Xavier
https://hastebin.com/guvatuwoja.cs
exactly where do u want to change the value of the variable
Anonymous
inside first if condition
Anonymous
and check if variable change or not after inner for loop completed
Anonymous
that I need
Anonymous
any body??
Anonymous
help me
Xavier
but yea there is no way of changing it unless u want to mess with js
Xavier
and dont get me wrong js is nice to use
Anonymous
and dont get me wrong js is nice to use
https://hastebin.com/alizacedat.cs
Anonymous
see this code this I actually need
Anonymous
but I can not use cnt like this
Anonymous
it not change using with tag
Xavier
https://hastebin.com/alizacedat.cs
Better get the condition in the view
Xavier
template is not meant for complex operations
Xavier
or use js
Anonymous
Better get the condition in the view
in view also it is complex thing
Anonymous
second way I can call js function and check if it true or not
Xavier
in view also it is complex thing
but u can perform complex operations in view
Xavier
that's it
Anonymous
yes
it's like simple
Anonymous
but u can perform complex operations in view
I don't know why django is simple??😐
Anonymous
after facing this many problem
Xavier
I don't know why django is simple??😐
cuz u haven't worked with other frameworks it's just like u calling honey better cuz u have never experienced sweet in your life
Xavier
frame of reference
Anonymous
thanks
Anonymous
dont take it offensively and good luck on your project
now tell how to call js function inside template tag??😂