Hey Max, Template tags are for keeping your code "clean" / organized / DRY, if you will only use this on one template, you can put it on the template itself. It's not hard to do it, I suggest taking a look at:
https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/pages/templates/pages/menus/tree.html or https://github.com/stephenmcd/cartridge/blob/0.10.0/cartridge/shop/templates/shop/includes/user_panel.html Based on it you can create a "recent_posts_panel.html" or something like that. For injecting in the context of the template the blog posts to be rendered (typically a view task) you can do it on the template tag, take a look at recent_comments: https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/generic/templatetags/comment_tags.py Or you can create a custom page processor (it's the Mezzanine way to add context or "view logic" without "touching" the views - which are a bit complicated due to all code needed to handle the default behaviour and messing with it will mess with all pages) - much more complicated and not worth it IMO. HTH, Rodrigo On Sat, Apr 23, 2016 at 1:29 AM, Max Edwards <[email protected]> wrote: > I'd like to be able to access blog_posts.objects_list in the > blog_post_detail template. I figured out how to do it by modifying the > source view to include "blog_posts" and not the specific instance based on > the slug but I'm wondering if there is a way to do it without messing with > the source code? Is there a template tag for doing this or could I write my > own? > > By the way, I'm trying to make it so a blog post list permanently on the > right panel even when viewing specific blog detail. Essentially, I'm trying > to put together a site similar to this template: > https://mezzathe.me/preview/buffalo/ > > -- > You received this message because you are subscribed to the Google Groups > "Mezzanine Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
