Re: Template within a Template
On Mon, Apr 27, 2009 at 9:12 PM, Renato Untalanwrote: > > Hey guys, > > In my current project, I'm making a soap call to a remote server, > which will return to me a Django template. > Once I have the Django template, I insert it into my Context object, > and when it renders, it renders the template in plain text, and does > not show any of the HTML tags. > > My context object's dictionary: > myVars = { "custom_settings_template" : connector_template } > > My template: > > > {{ connector_template }} I think you need the "safe" template filter there [1]: {{ connector_template|safe }} Beware of the html you are injecting from the soap call, the safe filter will let it pass unmodified. Maybe you can chain "safe" with the filter "removetags" [2] to get rid of potentially dangerous html tags. [1] http://docs.djangoproject.com/en/dev/ref/templates/builtins/#safe [2] http://docs.djangoproject.com/en/dev/ref/templates/builtins/#removetags Regards. -- Marcelo Ramos Django/Python developer --~--~-~--~~~---~--~~ 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: Template within a Template?
Actually I need another clue... I'm getting very confused about how to structure my Python projects/ apps. In settings.py: TEMPLATE_DIRS = ( "C:/Python/my_templates", ) In my template dir: mylinks/ mylinks/base_site.html mylinks/bookmark_list.html (extends base_site) Now in bookmark_list.html I have to say extends mylinks/base_site.html for it to find everything. If I change the tempalte dir in settings.py to "C:/Python/ my_templates/mylinks" then it looks for the first template in: C:/ Python/my_templates/mylinks/mylinks/ Can someone please tell me a generic structure, or something? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Template within a 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Template within a Template?
> I want all of my "views" (HTML pages) to use a common header, footer > etc. > > What is the python/django way of achieving this? http://www.djangoproject.com/documentation/templates/#template-inheritance It's somewhat backwards from how other template-languages work that I've used, but it makes sense in the context and works well. Your base template is what everything has in common, and then you fill in the holes with specifics. To fill in holes with mixed content, it works well to use custom template tags to reduce redundant rendering code: http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-tags "Writing your own template language extensions" sounds daunting, but the Django developers have really made it about as easy as it could possibly be...just follow the examples in the above link and, poof, you have a custom template tag. -tim --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Template within a Template?
On 21-Aug-07, at 8:20 PM, b3n wrote: > What is the python/django way of achieving this? template inheritance -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---