Skip to content

Commit

Permalink
Merge pull request #29 from encolpe/django-1.9
Browse files Browse the repository at this point in the history
Remove ConstantIncludeNode as it was removed in django 1.7
  • Loading branch information
renyi committed Feb 29, 2016
2 parents 1b117c1 + 521c64c commit dfc3fdc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
11 changes: 2 additions & 9 deletions mezzanine_themes/business/templatetags/include_strip.py
Expand Up @@ -2,22 +2,15 @@
register = template.Library()

from django.template.loader_tags import do_include
from django.template.loader_tags import ConstantIncludeNode, IncludeNode

class StripConstantIncludeNode(ConstantIncludeNode):
def render(self, context):
return super(StripConstantIncludeNode, self).render(context).strip()
from django.template.loader_tags import IncludeNode

class StripIncludeNode(IncludeNode):
def render(self, context):
return super(StripIncludeNode, self).render(context).strip()

def do_include_strip(parser, token):
result = do_include(parser, token)
if isinstance(result, ConstantIncludeNode):
result.__class__ = StripConstantIncludeNode
elif isinstance(result, IncludeNode):
result.__class__ = StripIncludeNode
result.__class__ = StripIncludeNode
return result

register.tag('include_strip', do_include_strip)
11 changes: 2 additions & 9 deletions mezzanine_themes/classic/templatetags/include_strip.py
Expand Up @@ -2,22 +2,15 @@
register = template.Library()

from django.template.loader_tags import do_include
from django.template.loader_tags import ConstantIncludeNode, IncludeNode

class StripConstantIncludeNode(ConstantIncludeNode):
def render(self, context):
return super(StripConstantIncludeNode, self).render(context).strip()
from django.template.loader_tags import IncludeNode

class StripIncludeNode(IncludeNode):
def render(self, context):
return super(StripIncludeNode, self).render(context).strip()

def do_include_strip(parser, token):
result = do_include(parser, token)
if isinstance(result, ConstantIncludeNode):
result.__class__ = StripConstantIncludeNode
elif isinstance(result, IncludeNode):
result.__class__ = StripIncludeNode
result.__class__ = StripIncludeNode
return result

register.tag('include_strip', do_include_strip)

0 comments on commit dfc3fdc

Please sign in to comment.