Hello, Djangoists! I'm wondering how fast is the include tag. Currently I have a Message model, which takes role of site messaging system with two ways of delivering - through a dashboard page and through Jabber. Via Jabber, each type of message has dedicated template and that template is then parsed by render_to_string and sent to the user. Everything works fine and I began to think about a possibility of using the same functionality to display them in dashboard.
The main problem with dashboard is the number of messages. In Jabber there was only one message that was once parsed and sent but in dashboard I would need to present about 30 of them on a page. Going that way, I should put a {% for %} loop and for each message include its template. I don't think this is optimal - after some looking at code there would be a get_template() called 30 times. On the other hand, writing ifequal tags for each type of message in main template should be faster, but the template code will lose on its clearness. After some thinking I've come with another solution - writing my own include tag with some cache that the template will only be compiled once. I guess it could be a bit slower than not using any inclusion tags, but not much. However I'm not sure if Django does not have some kind of similar mechanism in its core. What do you think about this? Thanks, Michael --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---