Sunday, October 2, 2011

Re: View decorator for common navigation elements?

heya,

This SO post seems to suggest that data and template tags shouldn't mix...

http://stackoverflow.com/questions/5046046/where-put-database-interaction-in-django-templatetags

Not sure how I feel about that myself - I see the philosophical argument behind it, but I don't see another more efficiently creating common page elements (like my category dropdowns).

Also, if you look at James Bennett's posts here:

http://www.b-list.org/weblog/2006/jun/07/django-tips-write-better-template-tags/

His code actually *does* interact with the database, as does the blog post here (http://www.webmonkey.com/2010/02/use_templates_in_django/#Roll_your_own_template_tags).

Also, as an aside, each link on our category dropdown is bound to a JS click event - not sure how this would tie in with the custom template tag - separate tag for that part of it?

Cheers,
Victor

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/9cYeQwELEYsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment