Hi All! I've written a custom template tag, but I get the error: 'reservationtags' is not a valid tag library: Could not load template library from django.templatetags.reservationtags, No module named reservationtags
I've looked in the archives and have tried everything I know so far: 1. templatetags directory is in the same level as models.py 2. templatetags has two files: __init__.py and reservationtags.py 3. I ran python manage.py shell, and executed: from pennysaver.reservations.templatetags import reservationtags and received no error. 4. reservationtags.py has: register = template.Library() and register.tag('columnize', do_columnize) For good measure, here's my code: from django import template register = template.Library() def do_columnize(parser, token): nodelist = parser.parse(('endcolumnize',)) parser.delete_first_token() #Get the number of columns, default 1 try: tag_name, columns, row_class, cell_class = token.contents.split(None, 3) except ValueError: columns = 1 return ColumnizeNode(nodelist, columns) class ColumnizeNode(template.Node): def __init__(self, nodelist, columns): self.nodelist = nodelist self.columns = columns self.counter = 1 def render(self, context): self.counter += 1 if (self.counter > self.columns): self.counter = 1 if (self.counter == 1): output = '<tr' if self.row_class: output += ' class="%s">' % self.row_class else: output += '>' output += '<td' if self.cell_class: output += ' class="%s">' % self.cell_class else: output += '>' output += self.nodelist.render(context) if (self.counter == self.columns): output += '</tr>' return output register.tag('columnize', do_columnize) Thanks for any help! Corey --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---