you must use the django.template.resolve_variable method:

obj = Foo.objects.get(id=resolve_variable(self.id, context))

which would be called within the render method of you templatetag
class, which contains the "context" from the view.


On Jun 21, 10:44 pm, Joru <avenp...@gmail.com> wrote:
> Is it possible to resolve tag value(in this is group.id) inside
> templatetags(tag_model(parser,token)) function without having it
> render in subclass of django.template.Node?
> Please give me some solution
>
> On Jun 20, 4:32 pm, Joru <avenp...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > Suppose I had templatetags
> >  {% tag_model tags.tag as tags with group=group.id %)
>
> > in my templatetags I define tag_model as a follow
> >       def tag_model(parser, token):
> >              bits = token.contents.split()
> >              len_bits = len(bits)
> >              name, value = bits[i].split('=')
>
> > when I did {{ group.id }} this give me a id group value
> > but when I do int(group.id) inside tag_model, the group.id is not well
> > passed to the function, instead I get a group.id as a string
> > How to get group.id value well passed inside tag_model?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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