diff --git a/ungleich_page/migrations/0001_initial.py b/ungleich_page/migrations/0001_initial.py index ae87b951..c40ccf40 100644 --- a/ungleich_page/migrations/0001_initial.py +++ b/ungleich_page/migrations/0001_initial.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.9.4 on 2017-10-17 21:49 +# Generated by Django 1.9.4 on 2017-10-18 13:40 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 +from django.db import migrations, models class Migration(migrations.Migration): @@ -18,6 +18,32 @@ class Migration(migrations.Migration): ] operations = [ + migrations.CreateModel( + name='Service', + 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')), + ('title', models.CharField(max_length=200)), + ('sub_title', models.CharField(max_length=200)), + ], + options={ + 'abstract': False, + }, + bases=('cms.cmsplugin',), + ), + migrations.CreateModel( + name='ServiceItem', + 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')), + ('title', models.CharField(max_length=200)), + ('description', djangocms_text_ckeditor.fields.HTMLField()), + ('glasfaser_service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ungleich_page.Service')), + ('image', filer.fields.image.FilerImageField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='service_item_image', to='filer.Image')), + ], + options={ + 'abstract': False, + }, + bases=('cms.cmsplugin',), + ), migrations.CreateModel( name='UngelichContactUsSection', fields=[ diff --git a/ungleich_page/models.py b/ungleich_page/models.py index e5916f18..f961e373 100644 --- a/ungleich_page/models.py +++ b/ungleich_page/models.py @@ -23,10 +23,27 @@ class UngelichTextSection(CMSPlugin): description = HTMLField() -class UngelichTextSectionWithImage(UngelichTextSection): +class Service(CMSPlugin): + title = models.CharField(max_length=200) + sub_title = models.CharField(max_length=200) + + def __str__(self): + return self.title + + +class ServiceItem(CMSPlugin): image = FilerImageField( null=True, blank=True, - related_name="utswi_image", + related_name="service_item_image", on_delete=models.SET_NULL - ) \ No newline at end of file + ) + title = models.CharField(max_length=200) + description = HTMLField() + glasfaser_service = models.ForeignKey(Service) + + def __str__(self): + return self.title + + def copy_relations(self, oldinstance): + self.glasfaser_service = oldinstance.glasfaser_service