From 8ce273ea1fbb4b7cb5bf742675b5b3d4bc0312ea Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Thu, 19 Oct 2017 00:28:34 +0200 Subject: [PATCH] Add SectionWithImage model and its migration --- .../migrations/0002_sectionwithimage.py | 30 +++++++++++++++++++ ungleich_page/models.py | 10 +++++++ 2 files changed, 40 insertions(+) create mode 100644 ungleich_page/migrations/0002_sectionwithimage.py diff --git a/ungleich_page/migrations/0002_sectionwithimage.py b/ungleich_page/migrations/0002_sectionwithimage.py new file mode 100644 index 00000000..87e742b3 --- /dev/null +++ b/ungleich_page/migrations/0002_sectionwithimage.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2017-10-18 22:02 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion +import filer.fields.image + + +class Migration(migrations.Migration): + + dependencies = [ + ('filer', '0004_auto_20160328_1434'), + ('ungleich_page', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='SectionWithImage', + 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')), + ('price_tag_url', models.URLField(default='', max_length=300)), + ('price_tag_image', filer.fields.image.FilerImageField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='price_tag_image', to='filer.Image')), + ], + options={ + 'abstract': False, + }, + bases=('ungleich_page.ungelichpicture',), + ), + ] diff --git a/ungleich_page/models.py b/ungleich_page/models.py index 9ed1ed64..2869373e 100644 --- a/ungleich_page/models.py +++ b/ungleich_page/models.py @@ -14,6 +14,16 @@ class UngelichPicture(CMSPlugin): title = models.CharField(max_length=400) +class SectionWithImage(UngelichPicture): + price_tag_image = FilerImageField( + null=True, + blank=True, + related_name="price_tag_image", + on_delete=models.SET_NULL + ) + price_tag_url = models.URLField(max_length=300, default="") + + class UngelichContactUsSection(CMSPlugin): email = models.EmailField(max_length=200)