Re: Template custom filter doesn't work

2008-11-19 Thread K*K
it works. Thank you so much ! On Nov 19, 6:48 pm, "Alex Koshelev" <[EMAIL PROTECTED]> wrote: > You have to convert value from string to integer: > >  int(arg) > > On Wed, Nov 19, 2008 at 13:18, K*K <[EMAIL PROTECTED]> wrote: > > > I modified some code so I made mistake again. -_-# > > > The rig

Re: Template custom filter doesn't work

2008-11-19 Thread Alex Koshelev
You have to convert value from string to integer: int(arg) On Wed, Nov 19, 2008 at 13:18, K*K <[EMAIL PROTECTED]> wrote: > > I modified some code so I made mistake again. -_-# > > The right result looks like this: > > $ ./manage.py shell > Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26) > [GCC

Re: Template custom filter doesn't work

2008-11-19 Thread K*K
I modified some code so I made mistake again. -_-# The right result looks like this: $ ./manage.py shell Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>>

Re: Template custom filter doesn't work

2008-11-19 Thread K*K
Sorry for my mistake, I wrote 'a' to test the code, if it's wrong I hope it will report a error. The corrected is here: {{ people.name|cut_by_string:"10" }} I run the code in the shell, it report right result to me, but I don't know why it's not apply effect in the web page. $ ./manage.py she

Re: Template custom filter doesn't work

2008-11-19 Thread Daniel Roseman
On Nov 19, 9:52 am, "K*K" <[EMAIL PROTECTED]> wrote: > Hi, All. > > I create a custom filter for cut too long string for my app. > > Like this: > > from django import template > from django.template.defaultfilters import stringfilter > > register = template.Library() > > @register.filter(name='cut

Template custom filter doesn't work

2008-11-19 Thread K*K
Hi, All. I create a custom filter for cut too long string for my app. Like this: from django import template from django.template.defaultfilters import stringfilter register = template.Library() @register.filter(name='cut_by_string') @stringfilter def cut_by_string(value, arg): if len