Hey Eduardo, and thanks for your inputs on multiple blogs. I am currently creating a multiple blog for a primary schcool with a blog for each grade. I am following your suggestions on the steps to follow in mezzanine. However the first point about copying all the the contents from mezzanine.blog made me a little confused. Normally I just copy one a file at a time to my blog app (eg. the blog_post_deatil.html) and then modifies this file, and then it will overwrite the blog_post_deatil.html in mezzanine.blog. However for the models I think it's different. I tried to copy the content of the models.py from mezzanine.blog to my blog app (same procedure as with the blog_post_deatil.html) but that throws me an error (something about a duplicate). So when you say copying all the contents from mezzanine.blog, do you also mean the models.py and how without getting an error? Kind regards, Jesper
fredag den 10. august 2018 kl. 20.18.27 UTC+2 skrev Eduardo Rivas: > > Sorry, don’t have enough time to write a code sample right now, but here > is a more detailed description of the steps: > > > > - Create a new application with all the contents copied from > mezzanine.blog. Let’s call it multiblog. Add it to installed apps. > - In models.py add a new Blog model inheriting from Slugged (this will > give it a title and slug). Register it in the admin so you can add Blog > instances. > - Add foreign keys to this new Blog model to BlogPost and > BlogCategory, so each post and category will belong to one blog. Create > the > required migrations. Make sure you expose the FK field in the admin so > each > post and category can choose to which Blog they will belong to. > - Rewrite urls.py to account for the Blog slug. For example: > “/blog/some-post” becomes “/blog/blog-slug/some-post”. The regex for the > URL should capture the blog slug so it will be passed to the view. > - Rewrite views.py to account for the new blog slug, and modify the > querysets to only look into the posts / categories for a particular blog. > Something like BlogPost.objects.filter(blog__slug=<captured slug>). > - Optionally rewrite the template-finding logic in the view to allow > you to use different (per-blog) templates. For example, you could have the > view load templates by looking inside folders that match the blog slug, > like “templates/blog/<variable slug>/blog_post_detail.html” and > “templates/blog/<variable slug>/blog_post_list.html”. > > > > Hope that helps! > > > > *From: *Amir <javascript:> > *Sent: *Thursday, August 9, 2018 7:48 AM > *To: *Mezzanine Users <javascript:> > *Subject: *[mezzanine-users] Re: Multiple Blogs > > > > This suggestion of yours is remarkable Eduardo and I am craving to have > multiple and separated blogs. I am a bit new to Django though, Could you > elaborate more on the details please? I could open a topic on > StackOverflow if you would prefer. This would be a huge help bro. > > On Tuesday, March 3, 2015 at 6:33:33 AM UTC+3:30, Eduardo Rivas wrote: > > Hello Dennis. I actually needed to do this for a project a few years ago. > As far a I know, Mezzanine doesn't support multiple blogs out of the box. > What I did was create a "Blog" model, which simply had a slug and title, > and then add it as FK to the standard BlogPost and BlogCategory models. > After that, it's just a matter of updating urls and views to account for a > blog_slug parameter to get the correct Blog instance. If you want to get > fancy, you can create "base" templates for each blog. That way, you get > unique blog posts, categories and templates for each blog. You'll also need > to modify the queries made by the Admin to only return the subset of > BlogPost's that match a Blog instance in particular. > > Important note: this of course implies you're "forking" Mezzanine's blog > app, so you will have to maintain it by yourself and install it in place of > the default one. > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Mezzanine Users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/mezzanine-users/LFhT0oryfEI/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > mezzani...@googlegroups.com <javascript:>. > 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 mezzanine-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/mezzanine-users/e0d65396-96ce-462b-acc7-796bed6d3088%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.