Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Customizing Django Templates Building Custom Filters Conjugation Tag

Why is my conjugate_is() filter not registering?

from django import template

register = template.Library()

@register.filter('conjugate_is')
def conjugate_is(num):
  if num == 1:
    return 'is'
  else:
    return 'are'

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

Even though the topic is filters, Task 3 of 4 asks: Now, register your functions as a simple tag!

@register.simple_tag()
def conjugate_is(arg):
    if arg == 1:
        return "is"
    else:
        return "are"

Using @register.filter will come up in another challenge.

Bam. Thanks.