Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-17 Thread Tom Evans
On Fri, Jun 17, 2011 at 4:32 PM, Rodrigo Gomes wrote: > Hi, > This sounds really better! But I tried it and got an error. > What I tried to do, is to pass a string value that is not on the context, > like this: > {% my_tag with param_str="a string here" %} {% with some_name_my_tag_wants=some_name

Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-17 Thread Rodrigo Gomes
Hi, This sounds really better! But I tried it and got an error. What I tried to do, is to pass a string value that is not on the context, like this: {% my_tag with param_str="a string here" %} and @register.inclusion_tag('my_tag.html',takes_context=True) def my_tag(context): param_str = c

Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-17 Thread Tom Evans
On Thu, Jun 16, 2011 at 7:03 PM, Rodrigo Gomes wrote: > Yes, but the point is not about generate code. Is to follow a DRY > principle...If I have a "multiple select list" with a specific > behavior,look-and-feel, with some javascript surrounding the code, etc, I > don't want to write this everywhe

Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-16 Thread Rodrigo Gomes
Yes, but the point is not about generate code. Is to follow a DRY principle...If I have a "multiple select list" with a specific behavior,look-and-feel, with some javascript surrounding the code, etc, I don't want to write this everywhere...I just want to create once and use it anywhere...with just

Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-15 Thread Kenneth Gonsalves
On Wed, 2011-06-15 at 11:01 -0300, Rodrigo Gomes wrote: > But I think that I'm missing something. Is it so hard to write a > simple > custom select box, for example? I need to write a parser, a render and > put > in the html in another file? Or there is a easer way to do that? > > as mentioned,

Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-15 Thread Tim Shaffer
The link was just an example. It could be a more complex block of HTML. Point being if the tag just massaging data into HTML, you can accomplish it with another template without creating a tag. -- You received this message because you are subscribed to the Google Groups "Django users" group. T

Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-15 Thread bruno desthuilliers
On 15 juin, 20:48, Tim Shaffer wrote: > Another option, if your use-case doesn't require anything terribly complex, > is to just include another template and pass your variables to it: > > {% include "link_to.html" with url="google.com" text="check out google" %} > > In link_to.html: > > {{ text }

Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-15 Thread Tim Shaffer
Another option, if your use-case doesn't require anything terribly complex, is to just include another template and pass your variables to it: {% include "link_to.html" with url="google.com" text="check out google" %} In link_to.html: {{ text }} https://docs.djangoproject.com/en/1.3/ref/templa

Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-15 Thread Rodrigo Gomes
Hi Tom, thanks for your reply. Inclusion tag seems to be better (to write) than the other kinds of tags. But I think that it is still too many things to do just to write a tag. But it works, and I'm doing this way right now :) Thanks, Rodrigo Gomes On Wed, Jun 15, 2011 at 11:11 AM, Tom Evans w

Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-15 Thread Tom Evans
On Wed, Jun 15, 2011 at 3:01 PM, Rodrigo Gomes wrote: > Hi, > I was looking for some 'html helpers' in django as we have on rails or java > (with tagfiles or taglibs), but I saw that it doesn't exist, according to > this stackoverflow response: > http://stackoverflow.com/questions/61451/does-djang

Helper methods like rails or taglibs/tagfiles like java

2011-06-15 Thread Rodrigo Gomes
Hi, I was looking for some 'html helpers' in django as we have on rails or java (with tagfiles or taglibs), but I saw that it doesn't exist, according to this stackoverflow response: http://stackoverflow.com/questions/61451/does-django-have-html-helpers The guy suggested to write custom template