Proposal: Can custom tag use namespace

30 views
Skip to first unread message

limodou

unread,
Aug 7, 2006, 1:36:00 PM8/7/06
to django-d...@googlegroups.com
How to use namespace? For example,

{% load example %}
{% example.testtag %}

And I think if the namespace can be optional is better. I don't know
if it's useful, but sometimes I read others projects, and as I reading
the template, I don't know which tag is in which file. So find the
correct tag definition file is somewhat diffcult. If I can add
namespace in the front of a custom tag name, it'll be easy to locate
the source file.

If it's not useful, just put it away. That's ok.

--
I like python!
My Blog: http://www.donews.net/limodou
My Django Site: http://www.djangocn.org
NewEdit Maillist: http://groups.google.com/group/NewEdit

Ian Holsman

unread,
Aug 8, 2006, 2:13:18 AM8/8/06
to django-d...@googlegroups.com
It would be nice mechanism to fully qualify a particular tag.

so for example if I had a 'calendar' tag, and hugo also had one, and I needed to use another templatetag of his in the same file I could specify

{% ian.calendar %}  instead of {% calendar %} so the template would know which one I was referring to.

Adrian Holovaty

unread,
Aug 12, 2006, 8:44:58 PM8/12/06
to django-d...@googlegroups.com
On 8/7/06, limodou <lim...@gmail.com> wrote:
> How to use namespace? For example,
>
> {% load example %}
> {% example.testtag %}
>
> And I think if the namespace can be optional is better. I don't know
> if it's useful, but sometimes I read others projects, and as I reading
> the template, I don't know which tag is in which file. So find the
> correct tag definition file is somewhat diffcult. If I can add
> namespace in the front of a custom tag name, it'll be easy to locate
> the source file.

Hi limodou,

This would be a nice improvement, and it seems like it could be
accomplished in a backwards-compatible fashion, by allowing
non-qualified template tag names. Would you (or anybody else) be
interested in coming up with a solution?

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

limodou

unread,
Aug 12, 2006, 10:02:28 PM8/12/06
to django-d...@googlegroups.com
Ok, I'll try to implement it.

limodou

unread,
Aug 13, 2006, 4:18:08 AM8/13/06
to django-d...@googlegroups.com
On 8/13/06, limodou <lim...@gmail.com> wrote:
> On 8/13/06, Adrian Holovaty <holo...@gmail.com> wrote:
> >
> > On 8/7/06, limodou <lim...@gmail.com> wrote:
> > > How to use namespace? For example,
> > >
> > > {% load example %}
> > > {% example.testtag %}
> > >
> > > And I think if the namespace can be optional is better. I don't know
> > > if it's useful, but sometimes I read others projects, and as I reading
> > > the template, I don't know which tag is in which file. So find the
> > > correct tag definition file is somewhat diffcult. If I can add
> > > namespace in the front of a custom tag name, it'll be easy to locate
> > > the source file.
> >
> > Hi limodou,
> >
> > This would be a nice improvement, and it seems like it could be
> > accomplished in a backwards-compatible fashion, by allowing
> > non-qualified template tag names. Would you (or anybody else) be
> > interested in coming up with a solution?
> >
> > Adrian
> >
> Ok, I'll try to implement it.
>
Adrian:

I'v finished my work, you can check it.

http://code.djangoproject.com/ticket/2539

I hope this would be useful.

Reply all
Reply to author
Forward
0 new messages