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

Jiayang Shi
seal-mask
.a{fill-rule:evenodd;}techdegree
Jiayang Shi
Python Web Development Techdegree Student 4,862 Points

Please help, what's wrong with my code? "Try again" appeard in the last step constantly. Thank you very much.

What's wrong with my tag used in last page?

code_challenges/templatetags/fairy_extras.py
from django import template

register = template.Library()

@register.simple_tag
def conjugate_is(num):
    if num == 1:
        return 'is'
    else:
        return 'are'
code_challenges/templates/code_challenges/list.html
{% load fairy_extras %}

 There {% conjugate_is(num_elf) %} {{ num_elf }} el{{ num_elf|pluralize:"f,ves" }}.
Cheo R
Cheo R
37,150 Points

I copied and pasted your code into the challenge and it worked just fine (for both challenges). So it might that you have extra spaces/blank lines somewhere?

1 Answer

Bogdan Lalu
Bogdan Lalu
6,419 Points

You mustn't pass the argument like in an ordinary function, tags work differently. Try {% conjugate_is num_elf %} instead of {% conjugate_is(num_elf) %}