Re: Global custom tags

2009-07-06 Thread diogobaeder

Great, guys! Solved! Now I have a global custom tag for recursive
nested list in all the views! Nice! :-)

Next step: see if my hosting privider has python-memcache to put these
guys under a cache... doesn't sound nice to have these repeated
queries on a bank, considering they won't change so much... :-P

Thanks for the help, guys! Thread solved!

Diogo



On Jul 5, 1:09 pm, diogobaeder  wrote:
> Thanks, Yu, it was a lack of attention of mine, not just a typo... I
> corrected the file name, now the module is being found, thanks! :-)
>
> Diogo
>
> On Jul 5, 6:32 am, Ronghui Yu  wrote:
>
> > _init_.py should be
>
> > __init__.py
>
> > or just a typo error in the mail?
>
> > diogobaeder ??:
>
> > > Koen,
>
> > > I tried to make an initial template tag, just to test and learn, but
> > > it's not working. I followed the instructions here
> > >http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#howt...
> > > and registered the compilation function, but it's not finding the
> > > module, like stated here in this stack trace, even though I've saved
> > > the _init_.py file:
> > >http://dpaste.com/63306/
>
> > > The code I used to test it is here:
> > >http://dpaste.com/63308/
>
> > > Any ideas?
>
> > > Thanks again!
>
> > > Diogo
>
> > > On Jul 3, 3:10 am, koenb  wrote:
>
> > >> On 3 jul, 04:59, diogobaeder  wrote:
>
> > >>> But where do I put the custom template, than? If I load it from an app
> > >>> template, I must create it under /templatetags/, and what if I
> > >>> want to call it from the base template? /templatetags/?
>
> > >>> Thanks!
>
> > >>> Diogo
>
> > >> I think you are missing something here: there really is no app
> > >> namespacing in templatetags: if you try to load a tag library, django
> > >> will search the templatetags folders located underneath all installed
> > >> apps. If it finds one that matches, it will use that one. This means
> > >> that you can use a tag library from app X in any template you use (no
> > >> matter where it is located), as long as app X is in the installed
> > >> apps. The downside of this is that you need to name your tag libraries
> > >> wisely, because tags.py in app X and tags.py in app Y will conflict.
>
> > >> Koen
>
> > --
> > Ronghui Yu 
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Global custom tags

2009-07-05 Thread diogobaeder

Thanks, Yu, it was a lack of attention of mine, not just a typo... I
corrected the file name, now the module is being found, thanks! :-)

Diogo



On Jul 5, 6:32 am, Ronghui Yu  wrote:
> _init_.py should be
>
> __init__.py
>
> or just a typo error in the mail?
>
> diogobaeder ??:
>
>
>
> > Koen,
>
> > I tried to make an initial template tag, just to test and learn, but
> > it's not working. I followed the instructions here
> >http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#howt...
> > and registered the compilation function, but it's not finding the
> > module, like stated here in this stack trace, even though I've saved
> > the _init_.py file:
> >http://dpaste.com/63306/
>
> > The code I used to test it is here:
> >http://dpaste.com/63308/
>
> > Any ideas?
>
> > Thanks again!
>
> > Diogo
>
> > On Jul 3, 3:10 am, koenb  wrote:
>
> >> On 3 jul, 04:59, diogobaeder  wrote:
>
> >>> But where do I put the custom template, than? If I load it from an app
> >>> template, I must create it under /templatetags/, and what if I
> >>> want to call it from the base template? /templatetags/?
>
> >>> Thanks!
>
> >>> Diogo
>
> >> I think you are missing something here: there really is no app
> >> namespacing in templatetags: if you try to load a tag library, django
> >> will search the templatetags folders located underneath all installed
> >> apps. If it finds one that matches, it will use that one. This means
> >> that you can use a tag library from app X in any template you use (no
> >> matter where it is located), as long as app X is in the installed
> >> apps. The downside of this is that you need to name your tag libraries
> >> wisely, because tags.py in app X and tags.py in app Y will conflict.
>
> >> Koen
>
> --
> Ronghui Yu 
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Global custom tags

2009-07-05 Thread Ronghui Yu
_init_.py should be

__init__.py

or just a typo error in the mail?

diogobaeder ??:
> Koen,
>
> I tried to make an initial template tag, just to test and learn, but
> it's not working. I followed the instructions here
> http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#howto-custom-template-tags
> and registered the compilation function, but it's not finding the
> module, like stated here in this stack trace, even though I've saved
> the _init_.py file:
> http://dpaste.com/63306/
>
> The code I used to test it is here:
> http://dpaste.com/63308/
>
> Any ideas?
>
> Thanks again!
>
> Diogo
>
>
>
> On Jul 3, 3:10 am, koenb  wrote:
>   
>> On 3 jul, 04:59, diogobaeder  wrote:
>>
>> 
>>> But where do I put the custom template, than? If I load it from an app
>>> template, I must create it under /templatetags/, and what if I
>>> want to call it from the base template? /templatetags/?
>>>   
>>> Thanks!
>>>   
>>> Diogo
>>>   
>> I think you are missing something here: there really is no app
>> namespacing in templatetags: if you try to load a tag library, django
>> will search the templatetags folders located underneath all installed
>> apps. If it finds one that matches, it will use that one. This means
>> that you can use a tag library from app X in any template you use (no
>> matter where it is located), as long as app X is in the installed
>> apps. The downside of this is that you need to name your tag libraries
>> wisely, because tags.py in app X and tags.py in app Y will conflict.
>>
>> Koen
>> 
> >
>
>   

-- 
Ronghui Yu 

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Global custom tags

2009-07-04 Thread diogobaeder

Koen,

I tried to make an initial template tag, just to test and learn, but
it's not working. I followed the instructions here
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#howto-custom-template-tags
and registered the compilation function, but it's not finding the
module, like stated here in this stack trace, even though I've saved
the _init_.py file:
http://dpaste.com/63306/

The code I used to test it is here:
http://dpaste.com/63308/

Any ideas?

Thanks again!

Diogo



On Jul 3, 3:10 am, koenb  wrote:
> On 3 jul, 04:59, diogobaeder  wrote:
>
> > But where do I put the custom template, than? If I load it from an app
> > template, I must create it under /templatetags/, and what if I
> > want to call it from the base template? /templatetags/?
>
> > Thanks!
>
> > Diogo
>
> I think you are missing something here: there really is no app
> namespacing in templatetags: if you try to load a tag library, django
> will search the templatetags folders located underneath all installed
> apps. If it finds one that matches, it will use that one. This means
> that you can use a tag library from app X in any template you use (no
> matter where it is located), as long as app X is in the installed
> apps. The downside of this is that you need to name your tag libraries
> wisely, because tags.py in app X and tags.py in app Y will conflict.
>
> Koen
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Global custom tags

2009-07-03 Thread diogobaeder

Great, koenb, now its getting even clearer to me! :-)

Thanks for the light,

Diogo



On Jul 3, 3:10 am, koenb  wrote:
> On 3 jul, 04:59, diogobaeder  wrote:
>
> > But where do I put the custom template, than? If I load it from an app
> > template, I must create it under /templatetags/, and what if I
> > want to call it from the base template? /templatetags/?
>
> > Thanks!
>
> > Diogo
>
> I think you are missing something here: there really is no app
> namespacing in templatetags: if you try to load a tag library, django
> will search the templatetags folders located underneath all installed
> apps. If it finds one that matches, it will use that one. This means
> that you can use a tag library from app X in any template you use (no
> matter where it is located), as long as app X is in the installed
> apps. The downside of this is that you need to name your tag libraries
> wisely, because tags.py in app X and tags.py in app Y will conflict.
>
> Koen
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Global custom tags

2009-07-03 Thread koenb

On 3 jul, 04:59, diogobaeder  wrote:
> But where do I put the custom template, than? If I load it from an app
> template, I must create it under /templatetags/, and what if I
> want to call it from the base template? /templatetags/?
>
> Thanks!
>
> Diogo
>

I think you are missing something here: there really is no app
namespacing in templatetags: if you try to load a tag library, django
will search the templatetags folders located underneath all installed
apps. If it finds one that matches, it will use that one. This means
that you can use a tag library from app X in any template you use (no
matter where it is located), as long as app X is in the installed
apps. The downside of this is that you need to name your tag libraries
wisely, because tags.py in app X and tags.py in app Y will conflict.

Koen
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Global custom tags

2009-07-02 Thread diogobaeder

But where do I put the custom template, than? If I load it from an app
template, I must create it under /templatetags/, and what if I
want to call it from the base template? /templatetags/?

Thanks!

Diogo



On Jul 2, 9:23 pm, Jonathan Buchanan 
wrote:
> On Thu, Jul 2, 2009 at 10:55 PM, diogobaeder wrote:
>
> > Hi there,
>
> > Is there a way to create a custom tag that can be used in different
> > applications at the same time, so that I could make the call on the
> > "base.html" template? The custom tag, here, is a blog subjects menu,
> > which I
> > want to use in all the pages (all the apps) of the website, in the
> > frontend.
>
> > I know that I must create a "templatetags"  subdirectory, to act as a
> > module, inside the apps, if I want to create a template tag for that
> > app,
> > but what if I want to make it visible to all apps and callable from a
> > base
> > template?
>
> > Thanks!
>
> If it only needs to be called in the base template, you could just {%
> load %} and call it there as normal.
>
> If it really does need to be available globally:
>
> http://www.djangosnippets.org/snippets/160/
>
> Regards,
> Jonathan.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Global custom tags

2009-07-02 Thread Jonathan Buchanan

On Thu, Jul 2, 2009 at 10:55 PM, diogobaeder wrote:
>
> Hi there,
>
> Is there a way to create a custom tag that can be used in different
> applications at the same time, so that I could make the call on the
> "base.html" template? The custom tag, here, is a blog subjects menu,
> which I
> want to use in all the pages (all the apps) of the website, in the
> frontend.
>
> I know that I must create a "templatetags"  subdirectory, to act as a
> module, inside the apps, if I want to create a template tag for that
> app,
> but what if I want to make it visible to all apps and callable from a
> base
> template?
>
> Thanks!

If it only needs to be called in the base template, you could just {%
load %} and call it there as normal.

If it really does need to be available globally:

http://www.djangosnippets.org/snippets/160/

Regards,
Jonathan.

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Global custom tags

2009-07-02 Thread diogobaeder

Hi there,

Is there a way to create a custom tag that can be used in different
applications at the same time, so that I could make the call on the
"base.html" template? The custom tag, here, is a blog subjects menu,
which I
want to use in all the pages (all the apps) of the website, in the
frontend.

I know that I must create a "templatetags"  subdirectory, to act as a
module, inside the apps, if I want to create a template tag for that
app,
but what if I want to make it visible to all apps and callable from a
base
template?

Thanks!
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---