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 Pluralize

Steven Lee
Steven Lee
2,955 Points

Why isn't my code working

I can't seem to figure out why this isn't working

code_challenges/templates/code_challenges/list.html
{{ num_elf }} el{{ num_elf|pluralize:"f, ves" }}.

2 Answers

Nearly there! You'll need to include the "f" on the end of "elf" in the template, so the plurarlize filter knows which value to substitute when it applies "ves":

{{ num_elf }} elf{{ num_elf|pluralize:"f,ves" }}

josephr
josephr
18,877 Points

I imagine you have already figured this out, but for the sake of others searching for answer:

It isn't working because of the space between the comma and "ves". I believe it is treating that space as part of the string you wish to append to "el." Not including the 'f' at the end is correct since we are providing the arguments for both singular and plural cases.

{{ num_elf }} el{{ num_elf|pluralize:"f,ves" }}