I am new to django and trying to use django-messages to add inbox/compose/outbox/trash functionality for my site users. From the doc i have completed the following steps:
- pip install django-messages
- added
'messages',toINSTALLED_APPS - added django-messages
'messages.context_processors.inbox',context processor toTEMPLATE_CONTEXT_PROCESSORS
Finally i am trying to use messages_inbox_count tag inside one of my template as follows:
<a href="/messages/inbox/">Inbox ({{ messages_inbox_count }})</a>
However, as expected this doesn’t show up any inbox count on the page.
Also, using django-debug-toolbar i am able to view that their is indeed a variable names messages_inbox_count. Below is a snipped from Templates Sidebar of django-debug-toolbar:
Context processors
django.contrib.auth.context_processors.auth
▶ Toggle Context
social_auth.context_processors.social_auth_by_name_backends
▶ Toggle Context
messages.context_processors.inbox
▼ Toggle Context
{'messages_inbox_count': 1}
django.core.context_processors.csrf
▶ Toggle Context
social_auth.context_processors.social_auth_backends
▶ Toggle Context
What am i really doing wrong here? Seems like a stupid thing to fix but with no luck at my end 🙁
Are you using a RequestContext-Instance to render the Template where the value does not appear, or just a Context?
(For example: if you use render_to_response, you need to make sure to include a
context_instance=RequestContext(request)argument.)