Ticket #2 (closed task: fixed)
Blogroll and other Widgets
| Reported by: | mitsuhiko | Owned by: | entequak |
|---|---|---|---|
| Priority: | blocker | Milestone: | Zine 0.1 |
| Component: | usability | Version: | |
| Keywords: | Cc: |
Description
Right now the plan is that plugins just provide functions or globals in the template namespace that you can use in a template to get some output. For example a funcion get_blogroll that returns a list of links for the blogroll. The question now is if that's a good idea. One the one hand this allows one to customize the output in detail, on the other hand just doing {{ get_blogroll() }} doesn't output something useful.
Probably the best idea is that get_blogroll and similar functions return objects with an __unicode__ method that render a small partial template. This has the advantage that you can still access attribute on it to get a customized version, on the other hand you can just do get_blogroll() in a template and you get a full blown blogroll ul (and textpress renders the template _blogroll.html in the background). Template designers could then even go and edit the template _blogroll.html to modify the output of that default call.
And then the next question is if there should be some sort of widget manager that appears as {{ render_widgets() }} in the template. In the admin panel user can then add get_blogroll and other functions to the widget area and they would appear where the render_widgets call is.
A first implementation can now be seen in textpress/widgets.py.