سؤال

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