Getting Started with DjangoCMS

When I was looking for Django based CMS , Chose Django CMS among many other CMSes.

https://www.djangopackages.com/grids/g/cms/

The main reason for choosing the Django CMS is , it is a developer friendly CMS.

First, go through the following tutorial

http://docs.django-cms.org/en/2.4.3/getting_started/tutorial.html

Some concepts, which was difficult to understand from the documentation

What is DjangoCMS?

It is a Django application with

  • admin interface customised for adding and organising pages
  • django template with new template tag “placeholder”, where snippets from different plugins can be displayed
  • default plugins
  • easy to write plugin interface

How the template works?

Templates are simple django templates with additional template tag called placeholder. This placeholder behaves exactly like django template blocks in the aspect of inheritance. In addition to that, you will be able to add plugins to the placeholder. The plugins can be any static or dynamically generated content.

How to install DjangoCMS with existing website in a specific path instead of root ?

Just add the following the snippet in your urls.py

urlpatterns += patterns('',
    url(r’^mycms/', include('cms.urls')),
)

Why model should always be giving for plugin , even though you dont have data to store?

The following page is a good start on writing plugin

http://docs.django-cms.org/en/2.4.3/extending_cms/custom_plugins.html

from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _

class HelloPlugin(CMSPluginBase):
    model = CMSPlugin
    render_template = "hello_plugin.html"

plugin_pool.register_plugin(HelloPlugin)

For any plugin, DjangoCMS should maintain relation between a particular page and our plugin. So, for all the plugin, you need to provide a model CMSPlugin or any model which has inherited CMSPluginBase.

This entry was posted in Django, python. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *