base.html
is used as the base template for all other pages. base.html
has the navigation bar and in the navigation bar, I want to show the number of messages the user received. Thus, I need to have a variable like {{number_of_messages}}
in the base.html
.
However, how should I pass this variable to it? Every template extends base.html
and is rendered by a function. I don't think returning number_of_messages
in all functions is a good way. Is there better way to implement this? How can I pass this variable to all templates?
base.html
is used as the base template for all other pages. base.html
has the navigation bar and in the navigation bar, I want to show the number of messages the user received. Thus, I need to have a variable like {{number_of_messages}}
in the base.html
.
However, how should I pass this variable to it? Every template extends base.html
and is rendered by a function. I don't think returning number_of_messages
in all functions is a good way. Is there better way to implement this? How can I pass this variable to all templates?
base.html
is used as the base template for all other pages. base.html
has the navigation bar and in the navigation bar, I want to show the number of messages the user received. Thus, I need to have a variable like {{number_of_messages}}
in the base.html
.
However, how should I pass this variable to it? Every template extends base.html
and is rendered by a function. I don't think returning number_of_messages
in all functions is a good way. Is there better way to implement this? How can I pass this variable to all templates?
base.html
is used as the base template for all other pages. base.html
has the navigation bar and in the navigation bar, I want to show the number of messages the user received. Thus, I need to have a variable like {{number_of_messages}}
in the base.html
.
However, how should I pass this variable to it? Every template extends base.html
and is rendered by a function. I don't think returning number_of_messages
in all functions is a good way. Is there better way to implement this? How can I pass this variable to all templates?
base.html
is used as the base template for all other pages. base.html
has the navigation bar and in the navigation bar, I want to show the number of messages the user received. Thus, I need to have a variable like {{number_of_messages}}
in the base.html
.
However, how should I pass this variable to it? Every template extends base.html
and is rendered by a function. I don't think returning number_of_messages
in all functions is a good way. Is there better way to implement this? How can I pass this variable to all templates?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.