customizing mezzanine

  • Last Update :
  • Techknowledgy :

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))

Suggestion : 2

It is possible to inject custom navigation items into the ADMIN_MENU_ORDER setting by specifying an item using a two item sequence, the first item containing the title and second containing the named urlpattern that resolves to the url to be used.,Using the standard Django admin the grouping and ordering of these models aren’t configurable, so Mezzanine provides the setting ADMIN_MENU_ORDER that can be used to control the grouping and ordering of models when listed in the admin area.,For example, to specify two groups Content and Site in your admin with the first group containing models from Mezzanine’s pages and blog apps, and the second with the remaining models provided by Django, you would define the following in your projects’s settings module:,What we achieve by using SingletonAdmin above, is an admin interface that hides the usual listing interface that lists all records in the model’s database table. When going to the “Site Alert” section of the admin, the user will be taken directly to the editing interface.

ADMIN_MENU_ORDER = (
   ("Content", ("pages.Page", "blog.BlogPost", "blog.Comment", )),
   ("Site", ("auth.User", "auth.Group", "sites.Site", "redirects.Redirect")),
)
from django.contrib
import admin

class BlogCategoryAdmin(admin.ModelAdmin):
   ""
"
Admin class
for blog categories.Hides itself from the admin menu
unless explicitly specified.
""
"

fieldsets = ((None, {
   "fields": ("title", )
}), )

def in_menu(self):
   ""
"
Hide from the admin menu unless explicitly set in ``
ADMIN_MENU_ORDER``.
""
"
for (name, items) in settings.ADMIN_MENU_ORDER:
   if "blog.BlogCategory" in items:
   return True
return False
ADMIN_MENU_ORDER = (
   ("Content", ("pages.Page", "blog.BlogPost", "blog.Comment",
      ("Media Library", "fb_browse"), )),
   ("Site", ("auth.User", "auth.Group", "sites.Site", "redirects.Redirect")),
)
DASHBOARD_TAGS = (
   ("blog_tags.quick_blog", "mezzanine_tags.app_list"),
   ("comment_tags.recent_comments", ),
   ("mezzanine_tags.recent_actions", ),
)
#...in myproj.filter
from markdown
import markdown

def markdown_filter(content):
   ""
"
Converts markdown formatted content to html
   ""
"
return markdown(content)

#...in myproj.settings
RICHTEXT_FILTERS = (
   "myproj.filter.markdown_filter",
)
from django.db
import models

class SiteAlert(models.Model):

   message = models.TextField(blank = True)

# Make the plural name singular, to correctly
# label it in the admin interface.
class Meta:
   verbose_name_plural = "Site Alert"

Suggestion : 3

Part 2: Add Pygments Styles, a Custom Font and Background Generate Pygments css Add the new CSS Links to the Base Template ,Ok, let's start customizing using a Pygments style for the markdown codehilter extension. Pygments and mezzanine-pagedown were installed and in the previous section, and there is a new manage.py command, pygments_styles.,Generate Pygments css,Great, so we've got a codehilite.css, but there's nothing automatic about having a new stylesheet pulled down. Delivered page content is all being produced by templates buried in Mezzanine apps. How do we get at them and start customizating?

sudo easy_install pip # no pip in ubuntu < 10, make sure
sudo pip install--upgrade virtualenv virtualenvwrapper
sudo pip install--upgrade 'fabric>=1.0'
sudo apt - get--yes install build - essential python - setuptools python - dev\
python - software - properties
sudo apt - get install--yes libtiff4 - dev libjpeg8 - dev zlib1g - dev libfreetype6 - dev\
liblcms1 - dev libwebp - dev
mkvirtualenv rodmtech_net # use your project name as you like
pip install mezzanine south django - compressor
cdvirtualenv # a virtualenvwrapper
function
mezzanine - project project
cd project
pwd > .. / .project # virtualenvwrapper has a cdproject
function that uses this path