Remove foreign keys between nested plugins
This commit is contained in:
parent
e563ae642f
commit
db45597e4e
3 changed files with 10 additions and 22 deletions
|
@ -67,6 +67,9 @@ class GlasfaserServicesItemPlugin(CMSPluginBase):
|
|||
parent_classes = ['GlasfaserServicesPlugin']
|
||||
|
||||
def render(self, context, instance, placeholder):
|
||||
context = super(GlasfaserServicesItemPlugin, self).render(
|
||||
context, instance, placeholder
|
||||
)
|
||||
context['instance'] = instance
|
||||
return context
|
||||
|
||||
|
@ -95,5 +98,8 @@ class GlasfaserAboutItemPlugin(CMSPluginBase):
|
|||
parent_classes = ['GlasfaserAboutPlugin']
|
||||
|
||||
def render(self, context, instance, placeholder):
|
||||
context = super(GlasfaserAboutItemPlugin, self).render(
|
||||
context, instance, placeholder
|
||||
)
|
||||
context['instance'] = instance
|
||||
return context
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.4 on 2017-10-18 14:43
|
||||
# Generated by Django 1.9.4 on 2017-10-18 18:23
|
||||
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):
|
||||
|
@ -13,8 +13,8 @@ class Migration(migrations.Migration):
|
|||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('cms', '0014_auto_20160404_1908'),
|
||||
('filer', '0004_auto_20160328_1434'),
|
||||
('cms', '0014_auto_20160404_1908'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
@ -36,6 +36,7 @@ class Migration(migrations.Migration):
|
|||
('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()),
|
||||
('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,
|
||||
|
@ -91,7 +92,6 @@ class Migration(migrations.Migration):
|
|||
fields=[
|
||||
('ungelichpicture_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='ungleich_page.UngelichPicture')),
|
||||
('inverted', models.BooleanField(default=False)),
|
||||
('glasfaser_about', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ungleich_page.About')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
|
@ -103,14 +103,4 @@ class Migration(migrations.Migration):
|
|||
name='image',
|
||||
field=filer.fields.image.FilerImageField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='image', to='filer.Image'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='serviceitem',
|
||||
name='glasfaser_service',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ungleich_page.Service'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='serviceitem',
|
||||
name='image',
|
||||
field=filer.fields.image.FilerImageField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='service_item_image', to='filer.Image'),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -40,14 +40,10 @@ class ServiceItem(CMSPlugin):
|
|||
)
|
||||
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
|
||||
|
||||
|
||||
class About(Service):
|
||||
pass
|
||||
|
@ -55,13 +51,9 @@ class About(Service):
|
|||
|
||||
class AboutItem(UngelichPicture):
|
||||
inverted = models.BooleanField(default=False)
|
||||
glasfaser_about = models.ForeignKey(About)
|
||||
|
||||
def __str__(self):
|
||||
alignment = "Right" if self.inverted else "Left"
|
||||
return "{alignment} - {title}".format(
|
||||
alignment=alignment, title=self.title
|
||||
)
|
||||
|
||||
def copy_relations(self, oldinstance):
|
||||
self.glasfaser_about = oldinstance.glasfaser_about
|
||||
|
|
Loading…
Reference in a new issue