From 6ec7fc182b4a60fb8d2ff49205347fb3fc260d81 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Thu, 23 Nov 2017 13:02:08 +0100 Subject: [PATCH] Add ungleich HTML only template --- ungleich_page/cms_plugins.py | 17 ++++++++++- .../migrations/0013_ungleichhtmlonly.py | 29 +++++++++++++++++++ ungleich_page/models.py | 4 +++ .../ungleich_page/ungleich/html_block.html | 5 ++++ 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 ungleich_page/migrations/0013_ungleichhtmlonly.py create mode 100644 ungleich_page/templates/ungleich_page/ungleich/html_block.html diff --git a/ungleich_page/cms_plugins.py b/ungleich_page/cms_plugins.py index d7c3c1a6..52762a1b 100644 --- a/ungleich_page/cms_plugins.py +++ b/ungleich_page/cms_plugins.py @@ -5,7 +5,7 @@ from .models import ( UngelichContactUsSection, UngelichTextSection, Service, ServiceItem, About, AboutItem, SectionWithImage, UngleichServiceItem, UngleichHeader, UngleichHeaderItem, UngleichProductItem, UngleichProduct, UngleichCustomer, - UngleichCustomerItem + UngleichCustomerItem, UngleichHTMLOnly ) @@ -274,3 +274,18 @@ class UngleichCustomerItemPlugin(CMSPluginBase): ) context['instance'] = instance return context + + +@plugin_pool.register_plugin +class UngleichHTMLPlugin(CMSPluginBase): + name = "ungleich HTML Plugin" + model = UngleichHTMLOnly + render_template = "ungleich_page/ungleich/html_block.html" + cache = False + + def render(self, context, instance, placeholder): + context = super(UngleichHTMLPlugin, self).render( + context, instance, placeholder + ) + context['instance'] = instance + return context diff --git a/ungleich_page/migrations/0013_ungleichhtmlonly.py b/ungleich_page/migrations/0013_ungleichhtmlonly.py new file mode 100644 index 00000000..c726a5a0 --- /dev/null +++ b/ungleich_page/migrations/0013_ungleichhtmlonly.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2017-11-23 11:49 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion +import djangocms_text_ckeditor.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms', '0014_auto_20160404_1908'), + ('ungleich_page', '0012_ungleichcustomer_ungleichcustomeritem'), + ] + + operations = [ + migrations.CreateModel( + name='UngleichHTMLOnly', + fields=[ + ('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('HTML', djangocms_text_ckeditor.fields.HTMLField()), + ], + options={ + 'abstract': False, + }, + bases=('cms.cmsplugin',), + ), + ] diff --git a/ungleich_page/models.py b/ungleich_page/models.py index 9024ac28..2113b4c0 100644 --- a/ungleich_page/models.py +++ b/ungleich_page/models.py @@ -144,3 +144,7 @@ class UngleichCustomerItem(CMSPlugin): ) url = models.URLField(max_length=300, default="", blank=True) description = HTMLField() + + +class UngleichHTMLOnly(CMSPlugin): + HTML = HTMLField() diff --git a/ungleich_page/templates/ungleich_page/ungleich/html_block.html b/ungleich_page/templates/ungleich_page/ungleich/html_block.html new file mode 100644 index 00000000..65c7b792 --- /dev/null +++ b/ungleich_page/templates/ungleich_page/ungleich/html_block.html @@ -0,0 +1,5 @@ +{% load cms_tags static %} +{{instance.HTML}} +{% for plugin in instance.child_plugin_instances %} + {% render_plugin plugin %} +{% endfor %}