How to add a new app to the main navigation.

150 views
Skip to first unread message

Sachin Gupta

unread,
May 20, 2012, 9:02:02 AM5/20/12
to mezzani...@googlegroups.com
Hi,

I am a little new to Mezzanine, and have been exploring things around. I needed to make some changes in the internal blog app, so I thought instead of modifying the Mezzanine code base, why not copy the blog code, edit it and then include as an external app. I have made the app but now the problem is that I want to add it to the main navigation. This link shows how I can add custom content types by inheriting the Page model. I have done this for another app, but in case of the blog app that I have copied from the mezzanine code base. The BlogPost model already inherits "Displayable, Ownable and RichText" and inheriting "Page" gives an error.

It is possible that I am missing out something very basic out here, but that is because I am a little still unclear about the Page model works. Since the internal blog app does not inherit the Page model, how is it registered as a page in Mezzanine? I do not know where to look for these settings in the code base.

Any help is appreciated.

Regards
Sachin

Stephen McDonald

unread,
May 20, 2012, 9:09:42 AM5/20/12
to mezzani...@googlegroups.com
The models in the blog app (custom or not) need not inherit from the Page model at all.

You have your blog app set up, its own models, views, and urlpatterns. Those urlpatterns will define the URLs for the different parts of the blog app.

The way things are integrated with pages, is that via the admin, you can add a page (of any Page type, but usually a RichTextPage), and give it the same URL as one the URLs defined by the urlpatterns in your blog app.

So in the blog app we have the urlpattern for /blog/ which loads the blog list view. Then in the admin we make a page and give it the URL "blog" (the page urls don't include leading/trailing slashes). Your blog app's view will be loaded, and the templates it loads will also have access to the blog page you created in the admin, for things like page title, keywords, etc.

Hope that clears things up.
--
Stephen McDonald
http://jupo.org

Sachin Gupta

unread,
May 20, 2012, 9:51:19 AM5/20/12
to mezzani...@googlegroups.com
Thanks Stephen,

Your explanation has cleared up a lot of things. I had misunderstood the design but now it's clear to me.

Thanks
Sachin
Reply all
Reply to author
Forward
0 new messages