
from django.template import Library
from ..html import TermsHTMLReconstructor

register = Library()


@register.filter
def replace_terms(html):
    parser = TermsHTMLReconstructor()
    parser.feed(html)
    return parser.out


from django.template import Library
from django.template.defaultfilters import stringfilter
from ..html import TermsHTMLReconstructor

register = Library()


@register.filter
@stringfilter
def replace_terms(html):
    parser = TermsHTMLReconstructor()
    parser.feed(html)
    return parser.out

Make sure the filter arg is a string.
Make sure the filter arg is a string.

  
  from django.template import Library
+ from django.template.defaultfilters import stringfilter
  from ..html import TermsHTMLReconstructor
  
  register = Library()
  
  
  @register.filter
+ @stringfilter
  def replace_terms(html):
      parser = TermsHTMLReconstructor()
      parser.feed(html)
      return parser.out
  
Make sure the filter arg is a string.
## Code Before:

from django.template import Library
from ..html import TermsHTMLReconstructor

register = Library()


@register.filter
def replace_terms(html):
    parser = TermsHTMLReconstructor()
    parser.feed(html)
    return parser.out

## Instruction:
Make sure the filter arg is a string.
## Code After:

from django.template import Library
from django.template.defaultfilters import stringfilter
from ..html import TermsHTMLReconstructor

register = Library()


@register.filter
@stringfilter
def replace_terms(html):
    parser = TermsHTMLReconstructor()
    parser.feed(html)
    return parser.out
