How to enable editing of the home page from the admin interface for mezzanine
Posted by: senex 13 years, 8 months ago
(Comments)
UPDATE
Mezzanine has gone through a lot in 2+ years and has a proper way f supporting the home page now. Following are the new instructiosn that come with urls.py
# HOMEPAGE AS AN EDITABLE PAGE IN THE PAGE TREE
# ---------------------------------------------
# This pattern gives us a normal ``Page`` object, so that your
# homepage can be managed via the page tree in the admin. If you
# use this pattern, you'll need to create a page in the page tree,
# and specify its URL (in the Meta Data section) as "/", which
# is the value used below in the ``{"slug": "/"}`` part.
# Also note that the normal rule of adding a custom
# template per page with the template name using the page's slug
# doesn't apply here, since we can't have a template called
# "/.html" - so for this case, the template "pages/"
# should be used if you want to customize the homepage's template.
Old method
A drawback of using mezzanine is that you cannot edit the home page from the admin interface. Here are quick instructions of how to change this
1) Create a page and call it "home"
2) edit urls.py and add the following snippet
from mezzanine.pages.views import page
def home_page(request):
request.path = "/"
return page(request, "home")
3) Still in urls.py, replace
url("^$", direct_to_template, {"template": ""}, name="home")
with
url("^$", home_page, name="home"),
You should end up with something that looks like the following:
urlpatterns = patterns("",
("^admin/", include(admin.site.urls)),
url("^$", home_page, name="home"),
("^", include("mezzanine.urls")),
Recent Posts
- Podcast feed for Connected Life Christian Church
- PulseAudio Sound Sink
- CppHeaderParser 2.4.3 Released
- CppHeaderParser 2.4.2 Released
- CppHeaderParser 2.4.1 Released
Archive
2016
- November (1)
2014
2013
- August (1)
2012
2011
2006
- June (2)
Categories
- Comic (1)
- CppHeaderParser (8)
- HOWTO (3)
- Project (2)
Authors
- senex (23)
Comments