Implementing Django CMS on existing Django project (website) is a very handy tool, enabling the client to access and edit entire front-end content like text or images.
First of all you need to install Django CMS toolbar. Go to your project's ‘base.html’ file and add the following code after '<!DOCTYPE html>':
{% load cms_tags sekizai_tags %}
Secondly, in the same ‘base.html’ file in the '<head></head>' section add the following two lines:
{% render_block "css" %}
{% render_block "js" %}
And in ‘base.html’ file right after the '<body>' tag add the following line:
{% cms_toolbar %}
Next we have to add a Placeholder to the section of the website we want to make CMS editable. Let's say your Django project (website) has a 'contact.html' page, now at the top of it you need to add the following code to activate Django CMS:
{% load cms_tags sekizai_tags %}
Next around the text you would like to make editable add a placeholder tag:
{% placeholder "about" or %} ... editable text ... {% endplaceholder %}
Now go to ‘settings.py’ file and in 'CMS_TEMPLATES' section add:
("public/contact.html", "Contact")
Finally, go to Django CMS admin page (via Django CMS toolbar) and create a new page, add a Title and Slug and in ‘Advanced Settings’ choose ‘Contact’ as a template.
If ‘contact.html’ page belongs to ‘index.html’, you should add ‘Index’ to 'CMS_TEMPLATES' and Django CMS admin page as described in the previous steps.
You can access website’s edit mode via the web address bar, for example, ‘siteurl/?edit’.
Click on ‘Structure’ in the Django CMS toolbar and you will see the placeholders listed. Now you can choose a plugin for text editing.
Technologies: Django CMS
VAIDOTASWEB.COM Blog provides simple to complex tutorials on topics like Web Development, Operating Systems, Graphic Design, Audio Equipment, etc.
Disclaimer: tutorials provided in this blog are intended for informational purposes. End results may vary depending on factors like different operating systems, software versions, etc.
VAIDOTASWEB.COM