Having trouble with this question for class. Not asking for answer just tell me how to solve it?

.Imagine that you have a fixed 30-year interest rate for your mortgage, and the economy has experienced unanticipated inflation. Examine who the winner and loser would be. Is it the borrower or the…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Custom Template Tags in Django

Pic Courtesy: Little Visuals

Django has this amazing feature of templating static HTML files to serve them as dynamic pages. If I want to add a title to my web page.

But what if I want to add different titles for different pages? Like Home for home page and cart page as Cart.

So for this we use template tags already defined in Django. I use

for replacing title blocks in each page extended from a base template with a blank title block like this

using another pre-defined template tag. Here {% %} is a template tag that is being used for adding data to static html pages by Django

These are the few steps you must follow:-

Here we are registering a custom tag with name remainder which takes value and arg from template like this

and returns the remainder.

First, we have to load the custom tag. And then we can use them as we want. I am checking the number of coins is even or not.

Add a comment

Related posts:

Love your neighbour like you love your cat

As I am writing this, I am joined by Gizmo, my cat, who, after walking around me in circles for five minutes and rubbing his head against my laptop twenty times, has finally decided to curl up in my…

Radiant Earth

Our design ambassador, Jane Carolan from Venia Design, shares spring design trends for flooring. Find out more here.. “Radiant Earth” is published by Liza Lee.

Deep Dive into Kafka with practical failure experiments

Apache Kafka is a distributed, horizontally scalable, fault-tolerant streaming platform that has the capability to publish, subscribe, process, and store streams of records. Kafka is a distributed…