I'm completely new to Django CMS and I'm stuck with this issue.
I have added a new module to an existing Django project and created a new Html page. This is the templates configuration in settings.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'site_cms', 'templates'),
],
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.i18n',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.template.context_processors.media',
'django.template.context_processors.csrf',
'django.template.context_processors.tz',
'sekizai.context_processors.sekizai',
'django.template.context_processors.static',
'cms.context_processors.cms_settings',
'core.context_processors.request_info',
],
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader'
],
},
},
]
In the new page, I'm extending the home page of the website as I've seen other pages do. This is the home page home.html (/core/templates/core/home.html):
{% load i18n easy_thumbnails_tags static %}
<!DOCTYPE html>
<html lang="en">
<head>
{% load staticfiles i18n menu_tags%}
</head>
<main>
<div class="container">
{% block content %}
This is my new page newpage.html (/newpage/templates/newpage/newpage.html)
{% extends "home.html" %}
{% load easy_thumbnails_tags i18n static core_filters bootstrap4 %}
{% block content %}
{% load bootstrap4 %}
<div class="container">
After creating the new page, I added it to the website main-menu through the Django CMS bar. I selected the template for the page to the one the parent (home) uses. I see this makes changes only in Database. OK, so now I have this page in the main-page menu, and in the Django CMS module.
The problem I have is that I cannot edit the structure of the page from the Django CMS bar. When I click on "Edit" button, I see the structure icon (www.localhost:8000/newpage/?structure), but the button is not active. I want to be able to add widgets to this page. How can I do that?How can I active the osibility to modify the structure?
On this project, I see some pages have this posibility to modify the structure of the page, and others don't. Maybe relevant, when I check the source of other pages with this posibility, I see:
'request': {
'language': 'en',
'model': 'cms.page',
'page_id': '3',
'pk': '3',
'url': '/admin/cms/page/resolve/',
'toolbar': '/admin/cms/usersettings/cms-toolbar/'
},
on my newpage I see:
'request': {
'language': 'en',
'model': '',
'page_id': '103',
'pk': '',
'url': '/admin/cms/page/resolve/',
'toolbar': '/admin/cms/usersettings/cms-toolbar/'
},
I use Python 3.6.9, Django 1.11.17 and django-cms 3.5.3. I know I can be missing some relevant info/code to show. Please ask, I'll post.
You need to load the editable parts of CMS. Primarily this would be a placeholder so that you can add content via the structure view.
Change newpage.html
to something like;
{% extends "home.html" %}
{% load cms_tags easy_thumbnails_tags i18n static core_filters bootstrap4 %}
{% block content %}
{% load bootstrap4 %}
<div class="container">
{% placeholder "content" %}
</div>
{% endblock %}
Now you'll see a placeholder called "content" in the structure view which you can add plugins to.