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

Customizing Django Templates conjugate_is templatetag

Not sure what is wrong

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=num_elf }} {{ num_elf }} el{{ num_elf|pluralize:"f,ves" }}.

2 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

conjugate_is is a tag so it needs to be called with {% and %}. The {{ represents when you want to print out a value, not use a tag.

Thank you :) Do you know if there will ever be a course on payments with Django?

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

I'm not currently planning a "Payments in Django" course but you're not the first to ask about it so maybe I should! If so, it'll be after the new year.

I think it would be a very useful course that would interest a lot of people, so hopefully there will be one :)