Monday, January 2, 2012

Re: Need help in renaming template tags

I now realize the problem is much more complex than what I though originally.

My suggestion to you is to use this nifty third-party tool called django-smart-load-tag[1].

Once you get it up and running, try using {% import %} instead of {% load %}.


Cheers,
AT

[1] https://github.com/codysoyland/django-smart-load-tag

On Mon, Jan 2, 2012 at 10:57 AM, Andre Terra <andreterra@gmail.com> wrote:
Hello,

I looked into your problem and realized the current implementation of {% load %} doesn't allow for homonimous tags. I plan on working toward a patch to fix this, but this can take a little while. Meanwhile, your best bet would be to fork one of the two projects and change the tag's name, I guess. Yes, it's very hacky, and no, don't do it in production.

I'll try to keep you posted once I've got a ticket in TRAC.


Cheers,
AT




On Mon, Jan 2, 2012 at 4:38 AM, CareerDhaba tech <tech@careerdhaba.com> wrote:
Just bumping this up in case anyone can help. 

Thanks,
Harshil


On Mon, Dec 26, 2011 at 7:31 PM, CareerDhaba tech <tech@careerdhaba.com> wrote:
Hey everyone,

I am running into an issue where two third party apps easy_thumbnail and sorl_thumbnail are using the custom template tag called thumbnail. Hence, I am actually unable to use the tag at all. I would like to change it so that the template tag from sorl_thumbnail is renamed as sorl_thumbnail. A similar issue has cropped up before over on SO, but it hasn't been resolved. See here: http://bit.ly/sE64Tb

I have created a templatetags module within one of my apps, and have tried a simple way to rename a registered tag as such: 

from django import template
from sorl.thumbnail.templatetags import thumbnail 

register = template.Library()

def do_sorl_thumbnail(parser, token):
return thumbnail(parser, token)
register.tag('sorl_thumbnail', do_sorl_thumbnail)

Do I need to write a compile function and a render function for this? Any help on this would be great. 

Thanks,
Harshil


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


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

No comments:

Post a Comment