from django import template
from django.template import Context


register = template.Library()


class TableNode(template.Node):
    def __init__(self, table):
        self.table = template.Variable(table)

    def render(self, context):
        table = self.table.resolve(context)
        context = Context({'table': table})
        t = template.loader.get_template("table/table.html")
        return t.render(context)

@register.tag
def render_table(parser, token):
    try:
        tag, table = token.split_contents()
    except ValueError:
        msg = '%r tag requires a single arguments' % token.split_contents()[0]
        raise template.TemplateSyntaxError(msg)
    return TableNode(table)

@register.inclusion_tag('table/table_js.html')
def render_table_js(table):
    return {'table': table}

@register.inclusion_tag('table/table_content.html')
def render_table_content(table):
    return {'table': table}

@@ -20,16 +20,17 @@
 template
+%0D
 %0Afrom dj
@@ -57,18 +57,21 @@
  Context
-%0A%0A
+%0D%0A%0D%0A%0D
 %0Aregiste
@@ -92,18 +92,21 @@
 ibrary()
-%0A%0A
+%0D%0A%0D%0A%0D
 %0Aclass T
@@ -129,16 +129,17 @@
 e.Node):
+%0D
 %0A    def
@@ -157,24 +157,25 @@
 elf, table):
+%0D
 %0A        sel
@@ -208,17 +208,19 @@
 e(table)
-%0A
+%0D%0A%0D
 %0A    def
@@ -242,16 +242,17 @@
 ontext):
+%0D
 %0A       
@@ -287,16 +287,17 @@
 context)
+%0D
 %0A       
@@ -332,16 +332,17 @@
  table%7D)
+%0D
 %0A       
@@ -394,16 +394,17 @@
 e.html%22)
+%0D
 %0A       
@@ -428,17 +428,19 @@
 context)
-%0A
+%0D%0A%0D
 %0A@regist
@@ -445,16 +445,17 @@
 ster.tag
+%0D
 %0Adef ren
@@ -479,16 +479,17 @@
  token):
+%0D
 %0A    try
@@ -489,16 +489,17 @@
     try:
+%0D
 %0A       
@@ -534,16 +534,17 @@
 ntents()
+%0D
 %0A    exc
@@ -558,16 +558,17 @@
 ueError:
+%0D
 %0A       
@@ -638,16 +638,17 @@
 nts()%5B0%5D
+%0D
 %0A       
@@ -687,16 +687,17 @@
 ror(msg)
+%0D
 %0A    ret
@@ -720,223 +720,6 @@
 ble)
-%0A%0A@register.inclusion_tag('table/table_js.html')%0Adef render_table_js(table):%0A    return %7B'table': table%7D%0A%0A@register.inclusion_tag('table/table_content.html')%0Adef render_table_content(table):%0A    return %7B'table': table%7D
+%0D
 %0A

Remove deprecated tags