I've been researching Mezzanine for some time now, but I haven't found much of tutorials beyond basic installation. Mezzanine docs contain information on how to customize Page models and adding new content types.
However, what I want to do is utilise existing content types (pages, blog posts) in different ways.
For example, I want to have custom "blog listing" page beyond basic default blog listing.
How do I even create that - second - blog page in the admin? How do I set it's template to my, custom template without touching default blog list template?
How do I therefore have 2 different blog listing pages?
Use the mezzanine.blog.models.BlogCategory model for your different blog lists. If you are not happy with 'category/' being in the path, you can copy and modify (below) the mezzanine.blog.urls to your project urls.py.
url("^%s(?P<category>.*)%s$" % _slashes,
"mezzanine.blog.views.blog_post_list",
name="blog_post_list_category")
To create category templates, take a look at the blog_post_list view and you will see:
templates.append(u"blog/blog_post_list_%s.html" %
unicode(category.slug))
To add a template for category "Foo", copy mezzanine/blog/templates/blog_post_list.html
to your project templates/blog/blog_post_list_foo.html
. The new template will render if you navigate to /blog/foo/.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With