How to concatenate strings in django templates?

3,825 views
Skip to first unread message

Muhammad Ahsan

unread,
Dec 8, 2010, 5:39:31 AM12/8/10
to Django developers

I want to concatenate string in django template tag like

{% extend shop/shop_name/base.html %}

here shop_name is my variable and i want to concatenate this with rest
of path. suppese i have shop_name=example.com

and i want result to extend shop/example.com/base.html

plz help. thanx in advance :)

Javier Guerra Giraldez

unread,
Dec 8, 2010, 7:27:54 AM12/8/10
to django-d...@googlegroups.com
On Wed, Dec 8, 2010 at 5:39 AM, Muhammad Ahsan
<muhamma...@mezino.com> wrote:
> {% extend shop/shop_name/base.html %}

shop/{{shop_name}}/base.html


... and this is the wrong list

--
Javier

Иван Маркеев

unread,
Dec 8, 2010, 7:48:00 AM12/8/10
to django-d...@googlegroups.com

You can put variable with needed path from view or url to your template.

08.12.2010 17:23 пользователь "Muhammad Ahsan" <muhamma...@mezino.com> написал:


--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-d...@googlegroups.com.
To unsubscribe from this group, send email to django-develop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.

Russell Keith-Magee

unread,
Dec 8, 2010, 6:49:21 PM12/8/10
to django-d...@googlegroups.com

If you're going to respond like this, it's only polite to point out
*why* this is the wrong list, and direct the author to the more
appropriate venue.

In this case, django-users would be a better place to post --
django-developers is for discussing the development of Django itself,
not for general how-to queries.

Yours,
Russ Magee %-)

Reply all
Reply to author
Forward
0 new messages