Tuesday, February 28, 2012

AW: custom tag not working

Nevermind…i loaded the filter.py in the wrong template -.-

 

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

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


Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im Auftrag von Szabo, Patrick (LNG-VIE)
Gesendet: Dienstag, 28. Februar 2012 13:15
An: django-users@googlegroups.com
Betreff: 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

 

 

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


No comments:

Post a Comment