Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default content plugin in django-cms

I started using django CMS project. It's great, built with modular design kept in mind... but what actually our customer wants is more simplicity:

Here, in django CMS every page can contain many content 'plugins' - be it text, image, or other. But the customer wants to have a text plugin active, selected and created automatically for every new page - and work on that text field. It's something that's just simpler for them to use.

Anyone have done something like that before with this CMS system? Or, any other simple CMS solutions for django you could recommend?

like image 307
kender Avatar asked Apr 13 '10 10:04

kender


4 Answers

There's a simple way to achieve the same functionality:

Provide a number of "prototype pages", one for each combination of page template and instantiated plugins you want to be available to the customer.

Have the customer create new pages by copying the template pages (can be done via the copy icon in the pages admin) rather than making a new page from scratch. In this way the required plugins will already be there, even with a default content if you wish.

like image 164
jacdeh Avatar answered Nov 17 '22 00:11

jacdeh


django CMS 3.0 supports default plugins for placeholders:

http://docs.django-cms.org/en/stable/reference/configuration.html#placeholder-default-plugins

like image 29
digi604 Avatar answered Nov 16 '22 22:11

digi604


Do you even need the CMS module?

The most basic of CMS's is nearly trivial using out-of-the-box django:

class ContentPage(models.Model):
   title = models.CharField(max_length=100)
   content = models.TextField()
   slug = models.SlugField()

def view_page(request, slug='home'):
   return render_to_response('content.html',
        { 'page':  ContentPage.objects.get(slug=slug) },
        context_instance=RequestContext(request)
    )

Just use the django admin to get started. But if you want more, and not give them the admin it's pretty easy to knock up a form/action to edit these fields.

If you need wysiwyg editing add tinymce to the form template. Something like:

 <script type="text/javascript" src="{{MEDIA_URL}}tiny_mce/tiny_mce.js"></script>
 <script type="text/javascript">
 tinyMCE.init({...

or (as mentioned by 'sayplastic') if you are still editing pages via through the admin you can attach Tiny to that too

class Media:
    js = (
        settings.MEDIA_URL + "jquery/jquery.js",
        settings.MEDIA_URL + "tiny_mce/tiny_mce.js",
        settings.MEDIA_URL + "js/admin.js"
    )
like image 21
John Mee Avatar answered Nov 17 '22 00:11

John Mee


Their is also FeinCMS which provides similar page tree editor and simpler block by default. It's more customizable.

If you don't need the tree editor, Django has built-in flatpages which are very simple.

like image 1
Wernight Avatar answered Nov 17 '22 00:11

Wernight