On 4/5/19 3:06 AM, Collin Anderson wrote:
Hi All,

I use django templates a lot and I always wished there was a myvar|startswith:"teststring", myvar|endswith:"teststring" and a myvar|contains:"teststring" filter.

It's almost like we need a syntax for calling methods with an argument, just like we can with filters.

For example (bring on the sheds for bikes!)

    {{ myvar.startswith<"teststring" }}

I instead do stuff like myvar|slice:":10" == "teststring" which is a total hack.

Is this something that could be simple and common enough to add to django as batteries-included built-in?

Alternatively, I recall some time in the past I may have written a "strings" template filter library simply to provide string methods as filters...

--
Curtis

--
You received this message because you are subscribed to the Google Groups "Django 
developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/a2b323bc-9f60-f4c9-6074-4d103bd6f930%40tinbrain.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to