-
Website
http://blog.clintecker.com/ -
Original page
http://blog.clintecker.com/2008/jul/6/django-chunks/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
Rian
2 comments · 1 points
-
Rob Hudson
2 comments · 3 points
-
Marcus Mattsson
2 comments · 8 points
-
Adam Turetzky
12 comments · 2 points
-
jasondavies
3 comments · 1 points
-
-
Popular Threads
-
My Decade in Photos: 2000-2001
23 hours ago · 6 comments
-
Mediaite: Q: Which Is The Top Site of 2009? A: Ars, duh. — Officially Lucky ❡ a blog by Clint Ecker
1 day ago · 1 comment
-
CoffeeScript is a little language that compiles into JavaScript — Officially Lucky ❡ a blog by Clint Ecker
3 days ago · 1 comment
-
My Decade in Photos: 2000-2001
Another thing I've been thinking about is some sort of method to include stuff like this when you're editing flatpages. For example, I might want to link to another flatpage, but instead of an anchor link I might want to type:
`{% link "about-page' %}`
But, of course, that wouldn't get evaluated because it's not really in the template. Perhaps some sort of template filter. Not sure yet ;)
Thasts what I where looking for.
For added deliciousness, we wrote a {% render_django %} template tag that will actually allow us to write Django template code as the content for Chunks (or even Flatpages), and render it with the current context.
It might also be handy in this case :)
I apply markdown to the snippets, and save that too in the model (for speed).
http://www.djangosnippets.org/snippets/861/
Well, I learned a lot in the process - and most of my code is oriented toward a hierarchical page (using MPTT) and url structure (using a single view to parse url components and dispatch pages), so maybe it was worth doing it from scratch.
Oh, and I call them GCB's. (Global Content Blocks), and mine support integrated post-rendering (to render tags in content) as well as optionally can be associated with a DB based template. I'll post that eventually.
learn something is to do it yourself. Happy coding!