Tuesday, February 28, 2012

custom tag not working

Hi,

 

I want to perform a substring on certain texts in my template (I can’t substring before….long story -.-).

I already have custom tags working so I really don’t know why this one isn’t.

In the files where I have the other tags as well I did this:

 

@register.filter(name ="cutnr")

@stringfilter

def cutnr(prodstr):

    return substring_before(prodstr, " #")

 

In my template there is:

 

{% for produkt, akt in produkte.items %}

<tr>

            <td>{{ var|cutnr:"asdsa#sss" }}</td>

 

So for testing i wanted to give my function a random string just to check it out.

Unfortunately I get this:

 

Exception Value:

Invalid filter: 'cutnr'

 

Any ideas ?

 

Best regards

. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo
XSLT Developer

LexisNexis
A-1030 Wien, Marxergasse 25

patrick.szabo@lexisnexis.at

Tel.: +43 1 53452 1573

Fax: +43 1 534 52 146



No comments:

Post a Comment