Hi Frankline, You can only reference variables in the templates directly with the blocktrans tag. See https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#blocktrans-template-tag. So you have to use the "with" statement on blocktrans to access properties of a class.
Regards, Andréas 2014-12-18 13:16 GMT+01:00 Frankline <[email protected]>: > > Hi all, > > I recently had a weird problem in my django templates regarding evaluating > variables within a blocktrans, but I finally figured it out. I guess I just > want to know the reason why it worked, an explanation sort of. > > THIS DID NOT WORK > {% blocktrans %}Approve all {{ objects.count }} users{% endblocktrans %} > > HOWEVER, THIS WORKED > {% blocktrans with objects.count as objects_count%}Approve all {{ > objects_count }} users{% endblocktrans %} > > Can someone explain to me the reason behind why the last code statement > worked as opposed to the first one? > > Thanks. > > With Regards, > Frankline > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAEAUGdX5it8Z3kLGKOspGZj%3DY%3DkstNeLHLvySGtogLXEOO58HQ%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAEAUGdX5it8Z3kLGKOspGZj%3DY%3DkstNeLHLvySGtogLXEOO58HQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALXYUbkfrmAUShH_VSbw8s0ih-8V21zWQ3FfwQCHVcaDum91qg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

