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:
parent
02b52b1cf1
commit
d9883cc503
4 changed files with 45 additions and 2 deletions
|
@ -3,7 +3,7 @@
|
|||
<!-- Set your background image for this header on the line below. -->
|
||||
<header class="intro-header"
|
||||
{% 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 %}
|
||||
style="background-image: url('{% static 'blog.ungleich.ch/img/home-bg.jpg' %}');"
|
||||
{% endif %}
|
||||
|
|
22
ungleich/migrations/0002_ungleichpage_image.py
Normal file
22
ungleich/migrations/0002_ungleichpage_image.py
Normal 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,
|
||||
),
|
||||
]
|
18
ungleich/migrations/0003_remove_ungleichpage_image_header.py
Normal file
18
ungleich/migrations/0003_remove_ungleichpage_image_header.py
Normal 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',
|
||||
),
|
||||
]
|
|
@ -2,12 +2,15 @@ from django.db import models
|
|||
|
||||
from cms.extensions import PageExtension
|
||||
from cms.extensions.extension_pool import extension_pool
|
||||
from filer.fields.image import FilerImageField
|
||||
|
||||
|
||||
# Create your models here.
|
||||
|
||||
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:
|
||||
app_label = 'ungleich'
|
||||
|
|
Loading…
Reference in a new issue