diff --git a/ungleich_page/cms_plugins.py b/ungleich_page/cms_plugins.py index 1b10375a..d7c3c1a6 100644 --- a/ungleich_page/cms_plugins.py +++ b/ungleich_page/cms_plugins.py @@ -4,7 +4,8 @@ from cms.plugin_pool import plugin_pool from .models import ( UngelichContactUsSection, UngelichTextSection, Service, ServiceItem, About, AboutItem, SectionWithImage, UngleichServiceItem, UngleichHeader, - UngleichHeaderItem, UngleichProductItem, UngleichProduct + UngleichHeaderItem, UngleichProductItem, UngleichProduct, UngleichCustomer, + UngleichCustomerItem ) @@ -241,3 +242,35 @@ class UngleichProductsItemPlugin(CMSPluginBase): ) context['instance'] = instance return context + + +@plugin_pool.register_plugin +class UngleichCustomerSectionPlugin(CMSPluginBase): + name = "ungleich Customer Section Plugin" + model = UngleichCustomer + render_template = "ungleich_page/ungleich/section_customers.html" + cache = False + allow_children = True + child_classes = ['UngleichCustomerItemPlugin'] + + def render(self, context, instance, placeholder): + context['customer_instance'] = instance + context['section_id'] = get_section_id(instance, 'customer') + return context + + +@plugin_pool.register_plugin +class UngleichCustomerItemPlugin(CMSPluginBase): + name = "ungleich Customer Item Plugin" + model = UngleichCustomerItem + render_template = "ungleich_page/ungleich/_customer_item.html" + cache = False + require_parent = True + parent_classes = ['UngleichCustomerSectionPlugin'] + + def render(self, context, instance, placeholder): + context = super(UngleichCustomerItemPlugin, self).render( + context, instance, placeholder + ) + context['instance'] = instance + return context diff --git a/ungleich_page/migrations/0012_ungleichcustomer_ungleichcustomeritem.py b/ungleich_page/migrations/0012_ungleichcustomer_ungleichcustomeritem.py new file mode 100644 index 00000000..148ce241 --- /dev/null +++ b/ungleich_page/migrations/0012_ungleichcustomer_ungleichcustomeritem.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2017-11-23 08:11 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion +import djangocms_text_ckeditor.fields +import filer.fields.image + + +class Migration(migrations.Migration): + + dependencies = [ + ('filer', '0005_auto_20171015_0703'), + ('cms', '0014_auto_20160404_1908'), + ('ungleich_page', '0011_ungleichproduct_ungleichproductitem'), + ] + + operations = [ + migrations.CreateModel( + name='UngleichCustomer', + fields=[ + ('service_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='ungleich_page.Service')), + ('section_class', models.CharField(blank=True, default='', max_length=100)), + ('carousel_data_interval', models.IntegerField(default=3000)), + ('bottom_text', djangocms_text_ckeditor.fields.HTMLField(default='

*ungleich means not equal to (≠) U+2260.

')), + ], + options={ + 'abstract': False, + }, + bases=('ungleich_page.service',), + ), + migrations.CreateModel( + name='UngleichCustomerItem', + 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')), + ('url', models.URLField(blank=True, default='', max_length=300)), + ('description', djangocms_text_ckeditor.fields.HTMLField()), + ('image', filer.fields.image.FilerImageField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='customer_item_image', to='filer.Image')), + ], + options={ + 'abstract': False, + }, + bases=('cms.cmsplugin',), + ), + ] diff --git a/ungleich_page/models.py b/ungleich_page/models.py index f936f23b..9024ac28 100644 --- a/ungleich_page/models.py +++ b/ungleich_page/models.py @@ -123,4 +123,24 @@ class UngleichProductItem(ServiceItem): class UngleichProduct(Service): - section_class = models.CharField(max_length=100, default="", blank=True) \ No newline at end of file + section_class = models.CharField(max_length=100, default="", blank=True) + + +class UngleichCustomer(Service): + section_class = models.CharField(max_length=100, default="", blank=True) + carousel_data_interval = models.IntegerField(default=3000) + bottom_text = HTMLField( + default='

*ungleich means ' + 'not equal to (≠) U+2260.

' + ) + + +class UngleichCustomerItem(CMSPlugin): + image = FilerImageField( + null=True, + blank=True, + related_name="customer_item_image", + on_delete=models.SET_NULL + ) + url = models.URLField(max_length=300, default="", blank=True) + description = HTMLField() diff --git a/ungleich_page/templates/ungleich_page/ungleich/_customer_item.html b/ungleich_page/templates/ungleich_page/ungleich/_customer_item.html new file mode 100644 index 00000000..794bcb06 --- /dev/null +++ b/ungleich_page/templates/ungleich_page/ungleich/_customer_item.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/ungleich_page/templates/ungleich_page/ungleich/section_customers.html b/ungleich_page/templates/ungleich_page/ungleich/section_customers.html new file mode 100644 index 00000000..afe67b2a --- /dev/null +++ b/ungleich_page/templates/ungleich_page/ungleich/section_customers.html @@ -0,0 +1,35 @@ +{% load cms_tags custom_tags %} +
+
+
+

{{ customer_instance.title }}

+

{{ customer_instance.sub_title }}

+
+
+
+ + + +
+
+
+
+ {{customer_instance.bottom_text}} +
+
\ No newline at end of file