Hi guys :o) Im attempting to create a template tag but I get a strange response. it returns "None" where I put the {% if blog_detail %} tag
Here is my template tag class BlogNode(Node): def __init__(self, user, varname): self.user, self.varname = user, varname def render(self, context): try: context[self.varname] = Blog.objects.get(user=self.user) except ObjectDoesNotExist: context[self.varname] = False @register.tag def get_blog(parser, token): # {% get_blog for user_object as object_detail %} # {% if blog_detail %} etc... bits = token.contents.split() if len(bits) != 5: raise TemplateSyntaxError, "get_blog tag takes exactly five arguments" if bits[1] != 'for': raise TemplateSyntaxError, "second argument to get_blog tag must be 'for'" if bits[3] != 'as': raise TemplateSyntaxError, "third argument to get_blog tag must be 'as'" return BlogNode(bits[2], bits[4]) Why does it response with a "None" message? Thanks :o) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---