Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Customizing Django Templates Building Custom Filters Conjugation Tag

Update the conjugate_is function to return the string 'are' if the number is anything other than 1.

Having trouble with this kinda remember how to do it but I think I'm doing something wrong

code_challenges/templatetags/fairy_extras.py
from django import template

register = template.Library()

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

There is {{ num_elf }} el{{ num_elf|pluralize:"f,ves" }}.
Cody Lovell
seal-mask
.a{fill-rule:evenodd;}techdegree
Cody Lovell
Python Web Development Techdegree Student 7,223 Points

I know this is a late answer, but just in case: you just need to get rid of the second check for "int == 1" in the else clause. Because they want are returned if int is anything other than 1.

2 Answers

Updated code will look like:

from django import template

register = template.Library()

def conjugate_is(int): 
    if int == 1: 
        return 'is'
    else:
        return 'are'

@Cody Lovell Thanks for the help I would mark best answer but it's not giving me the option