Ok, thank you all for your help
On 12 nov, 15:19, Steve Holden <[EMAIL PROTECTED]> wrote:
> By all means use your custom tag. Inside the code for the tag, use a
> template to generate the HTML. That's all!
>
> regards
> Steve
>
> gontran wrote:
> > Could you be more explicite because I don't understand everything and
> > why not using my custom tag? (which works fine)
>
> > On 12 nov, 14:43, bruno desthuilliers <[EMAIL PROTECTED]>
> > wrote:
>
> >> On 12 nov, 14:25, gontran <[EMAIL PROTECTED]> wrote:> On 12 nov, 13:22,
> >> Steve Holden <[EMAIL PROTECTED]> wrote:
>
> >>>> gontran wrote:
>
> >> (snip - about using templates instead of building html in python code)
>
> >>>>> -> I'm using this function in a custom tag to build a menu
>
> >>>> And is there a rule that says you can't do that using templates?
> >>>> Hello Steve,
>
> >>> Maybe I'm wrong but I want to display this menu in all pages of my
> >>> site, so by using a custom tag, I can display my menu without having
> >>> to import my model in my different views.
>
> >> This doesn't prevent you from using a template to do the html
> >> rendering:
>
> >> class MyNode(Node):
> >> def render(self, context):
> >> template = get_template('path/to/mytemplate.html')
> >> context.push()
> >> try:
> >> context['foo'] = 'bar'
> >> return template.render(context)
> >> finally:
> >> context.pop()
>
> >> HTH
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---