Hi.  I have the following template tag:

@register.filter(name='elementtotext')
@stringfilter
def elementtotext(string):
    itext='Unknown'
    if string=='DR':
        itext='Door'
    if string=='FL':
        itext='Flooring'
    if string=='FO':
        itext='Foundation'
    if string=='FR':
        itext='Framing'
    if string=='GR':
        itext='Grounds'
    if string=='HV':
        itext='HVAC / Utilities'
    if string=='MI':
        itext='Miscellaneous'
    if string=='RF':
        itext='Roof'
    if string=='WM':
        itext='Wall Material'
    if string=='WI':
        itext='Window'
    return itext

The purpose of the tag is to take a record set field value and return
the text equivalent of that value.  My field name in this example is
tm.element.

I can print the raw code to the screen fine but I'm having trouble
running it through my template tag.  Can someone tell me the proper
syntax?

I'm trying {% elementtotext tm.element %} and it errors out.

I'm using python2.5 and django .97 or thereabout.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to