문제

I'm new to django and trying to concatenate a variable and string before urlencoding the two.

I already have #{profile.name|urlencode} but need something like #{urlencode('string' + profile.name)}

Any help is very appreciated

도움이 되었습니까?

해결책

Concatenate string with profile.name using add and assign variable to it:

{% with name="string"|add:profile.name %}
    {{ name|urlencode  }}
{% endwith %}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top