> Second, it is obviously and woefully inefficient to do this for > several blocks on the page. I may have 5 or more, and I may want to > add some in the future. Is this the place for a custom templatetag? > Has someone already put something like this together?
I haven't done exactly this, but I've done something similar, and can maybe help with some general principles. It's not clear exactly what's going into these pods, but it's usually a bad idea to have things like 'style' or 'placement' in the database tables: that's presentational logic, not data. I would suggest either {% include %}-ing smaller template snippets, or using custom template tags. If the snippet/tag can get all its information from the existing context, use an include; if it needs its own database queries/extended python, use a tag. Still kind of shooting in the dark: information such as how the pods are to be displayed should probably come in through the view. Maybe via a GET query, maybe via saved user settings. You could create a dictionary in the view, where say the keys were snippet/tag names, and the values a list of style/presentation parameters that were passed to each appropriate snippet. Something like that. Then your template is simply a matter of checking if the dict has certain keys, and then using the dict values to populate CSS style attributes, or to set variables telling a template tag which queries to perform (actually that last might not work, can't remember...). As always, B-List has the goods: http://www.b-list.org/weblog/2006/jun/07/django-tips-write-better-template-tags/ Hope something in there helps, Eric --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---