On Wed, Nov 10, 2010 at 11:25 AM, Kenneth Gonsalves <law...@au-kbc.org> wrote:
> On Wed, 2010-11-10 at 03:21 -0800, Daniel Roseman wrote:
>> On Nov 10, 11:19 am, Kenneth Gonsalves <law...@au-kbc.org> wrote:
>> > hi,
>> >
>> > using trunk. I have line in template like this:
>> >
>> >     {% get_current_language as LANGUAGE_CODE %}
>> > I want to pass the current language to a templatetag for some
>> > processing. So i call it like this:
>> >
>> > {% get_menu "LANGUAGE_CODE" %}
>> >
>> > to get the language code, I try:
>> >
>> > self.lang = Variable(lang), but it is not working. I am not getting
>> the
>> > language code, rather I am getting the string 'LANGUAGE_CODE'. Any
>> > clues?
>>
>> Surely you don't need the quotes?
>>
>>     {% get_menu LANGUAGE_CODE %}
>
> same result with or without the quotes

But only because you aren't resolving your variables correctly in your
template tag. Do you have code which does the equivalent of this:

from django.template import Variable

class UserNode(Node):
  def __init__(self, user):
    self.user = Variable(user)

  def render(self, context):
    user = self.user.resolve(context)
    return ...


Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to