Issue 40 in django-messages: please add {% get_inbox_count as var1 %}

5 views
Skip to first unread message

codesite...@google.com

unread,
Oct 8, 2009, 9:50:17 AM10/8/09
to pinax-...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 40 by neutrinus: please add {% get_inbox_count as var1 %}
http://code.google.com/p/django-messages/issues/detail?id=40

We would like to bold the counter if there are unread messages.


example code:
{% load inbox %}{% ifequal inbox_count 0 %}<b>{% endifequal %}({%
inbox_count %}){% ifnotequal inbox_count 0 %}</b>{% endifnotequal %}

This of course doesnt work, because inbox_count is a function ( prints the
value) instead of being a variable. So, we need something like {%
get_inbox_count as var1 %}.


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

codesite...@google.com

unread,
Oct 8, 2009, 9:58:59 AM10/8/09
to pinax-...@googlegroups.com

Comment #1 on issue 40 by a...@rcs4u.de: please add {% get_inbox_count as
var1 %}
http://code.google.com/p/django-messages/issues/detail?id=40

good idea. In the meantime (if you show the inbox count on the majority of
your
site's pages) you might want to try the context-processor.

add "messages.context_processors.inbox" to
settings.TEMPLATE_CONTEXT_PROCESSORS

and get a {{ messages_inbox_count }} variable in your templates.

codesite...@google.com

unread,
Oct 12, 2009, 8:14:54 AM10/12/09
to pinax-...@googlegroups.com

Comment #2 on issue 40 by neutrinus: please add {% get_inbox_count as
var1 %}
http://code.google.com/p/django-messages/issues/detail?id=40

Patch proposal in attachement.

Thx for comment but I'm using this on only few pages - so I don't want to
have this
in TEMPLATE_CONTEXT_PROCESSOR.

Attachments:
get_inbox_count.diff 838 bytes

codesite...@google.com

unread,
Oct 12, 2009, 8:38:42 AM10/12/09
to pinax-...@googlegroups.com
Updates:
Status: Fixed
Mergedinto: -

Comment #3 on issue 40 by a...@rcs4u.de: please add {% get_inbox_count as
var1 %}
http://code.google.com/p/django-messages/issues/detail?id=40

This issue was closed by revision r118.

codesite...@google.com

unread,
Oct 12, 2009, 8:46:48 AM10/12/09
to pinax-...@googlegroups.com

Comment #4 on issue 40 by a...@rcs4u.de: please add {% get_inbox_count as
var1 %}
http://code.google.com/p/django-messages/issues/detail?id=40

instead of adding a second templatetag I have added an option to the
existing
inbox_count tag to specify an 'as varname' option. This change is fully
backwards-compatible and should fix this issue. Anyway, thank you very much
for the
attached patch and bringing up this issue.

Reply all
Reply to author
Forward
0 new messages