N
N
Nik17122016-11-03 14:35:11
Django
Nik1712, 2016-11-03 14:35:11

How to trim string in django template?

{{ str|replace:'|/\..+/g|' }} I'm trying to cut a string after a dot
on regexr.com, the expression /\..+/g selects the text after the dot, however, as I understand it, something like (/\..+/g, '') is needed - tell me how it is in template correctly to write down?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zelsky, 2016-11-03
@zelsky

Create your own template tag that will do whatever you want with the string

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question