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

Ryan Gostic
Ryan Gostic
20,790 Points

Now change the template so that if num_elf is 1, the word "elf" is singular, but if num_elf is more than 1, the word "el

asd

code_challenges/templates/code_challenges/list.html
{{ num_elf }} elf{{num_elf | pluralize:"ves"}}

1 Answer

Right now your tag is displaying "elf" for single, and "elfves" for plural because you have set the custom plural attribute, but included the single conjugation in your text.

Instead, you need to set both the single and plural forms inside the tag, like:

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

https://docs.djangoproject.com/en/2.1/ref/templates/builtins/

Hope that helps