Posted by Leeland |
|
I have made a couple of blogs on my site and they both show up regardless of anything I try.
I want one link to show one blog category and another link to show the alternate. I can't figure out how to lock the blog view down to only one category. |
|
Posted by Herbert Poul |
|
currently this is not possible..
in my mindset.. you are having one blog .. with multiple categories :) but in the end .. it shouldn't be too hard to change that .. so .. i did it .. (it's committed) Index: sphenecoll/sphene/sphblog/views.py =================================================================== --- sphenecoll/sphene/sphblog/views.py (revision 629) +++ sphenecoll/sphene/sphblog/views.py (working copy) @@ -35,8 +35,12 @@ category__id__in = map(lambda x: x.id, categories) ).order_by( '-postdate' ) return threads -def blogindex(request, group): +def blogindex(request, group, category_id = None): categories = get_board_categories(group) + if category_id is not None: + category_id = int(category_id) + categories = [category for category in categories \ + if category.id == category_id] if not categories: return render_to_response( 'sphene/sphblog/nocategory.html', { }, all you need now is to have a urlconf: e.g. url(r'^cat/(?P<category_id>\d+)/$', 'blogindex'), (if it is your root urlconf you need to add { 'groupName': None } as third parameter ..) the only problem remaining (that i can think of) .. is that in the breadcrumbs of posts the 'Blog' link would still link to the main index listing all categories.. for this you could overwrite the sphene/sphblog/show_blogentry.html template.. or .. create a 'categorytypes.py' in your application, extend HiddenBlogCategoryType and overwrite get_show_thread_template .. returning your own template.. which itself extends show_blogentry.html .. and only overwrites the {% block sphboard_breadcrumb %} - this would keep customizations to a minimum.. but is a bit more complicated Hey, we have Signatures !!! Great, isn't it ? ;) |
Please login to post a reply.