Sunday, January 1, 2012

Re: Need help in renaming template tags

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.

No comments:

Post a Comment