models: UngleichPage, -image_header +image

The filed image_header was removed, and
a new filed image was added, the reason
for this change is that image being a
FilerImageFiled can make use of previously
uploaded images while with image_header only
uploads where available.

Signed-off-by: rscnt <rascnt@gmail.com>
This commit is contained in:
rascencio 2015-05-24 10:59:26 -06:00
parent 37e527bd28
commit 3395220e65
4 changed files with 45 additions and 2 deletions

View file

@ -3,7 +3,7 @@
<!-- Set your background image for this header on the line below. --> <!-- Set your background image for this header on the line below. -->
<header class="intro-header" <header class="intro-header"
{% if request.current_page.ungleichpage %} {% if request.current_page.ungleichpage %}
style="background-image: url('{{ request.current_page.ungleichpage.image_header.url }}');" style="background-image: url('{{ request.current_page.ungleichpage.image.url }}');"
{% else %} {% else %}
style="background-image: url('{% static 'blog.ungleich.ch/img/home-bg.jpg' %}');" style="background-image: url('{% static 'blog.ungleich.ch/img/home-bg.jpg' %}');"
{% endif %} {% endif %}

View file

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import filer.fields.image
class Migration(migrations.Migration):
dependencies = [
('filer', '0002_auto_20150522_0450'),
('ungleich', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='ungleichpage',
name='image',
field=filer.fields.image.FilerImageField(null=True, related_name='ungleinch_page_image', to='filer.Image', blank=True),
preserve_default=True,
),
]

View file

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ungleich', '0002_ungleichpage_image'),
]
operations = [
migrations.RemoveField(
model_name='ungleichpage',
name='image_header',
),
]

View file

@ -2,12 +2,15 @@ from django.db import models
from cms.extensions import PageExtension from cms.extensions import PageExtension
from cms.extensions.extension_pool import extension_pool from cms.extensions.extension_pool import extension_pool
from filer.fields.image import FilerImageField
# Create your models here. # Create your models here.
class UngleichPage(PageExtension): class UngleichPage(PageExtension):
image_header = models.ImageField(upload_to='image_header') #image_header = models.ImageField(upload_to='image_header')
image = FilerImageField(null=True, blank=True,
related_name="ungleinch_page_image")
class Meta: class Meta:
app_label = 'ungleich' app_label = 'ungleich'