Intro to Context Processor
Hi all,
We can all agree that we have come across request.user in a django project. Have you ever wondered w...
For further actions, you may consider blocking this person and/or reporting abuse
I did exactly the same procidure, but I want to pass 4 images to the navbar of my website. I am accessing the image as following:
<img src="{{ labels.label_services.url }}">
but it doesnt work! any ideas?
Did you setup the static and media urls in settings ? It should work if you had set those up.
the problem was with the looping through the dict that I sent in the template. your explanations were sufficient. thanks
thanks, very simple and nice.
Does using a lot of context processors create a mess? How do you keep tracking which one is context processor which one is normal?
I did switch over to using React/Next.js as my frontend recently. 😁
But, i would suggest using a naming scheme and folder structure, so you know where and which ones are yours.
Hi, What is the problem ?
I am trying to say that there is simpler way to write year in footer in Django without resorting to creating forms. But the liquid language that Dev.to uses does not allow me to insert it
The footer is just an example of using context processor. But I am interested to know an alternate method. Can you write it elsewhere and send me the link. I’ll add it to the blog.
{percent now 'Y' percent}
replace 'percent' with %
the now method with 'Y' returns the given year in the template
This was exactly what I needed. Thank you!
Happy to help.
{percent now 'Y' percent}
replace the 'percent' with %
Awesome!
Thanks man