Skip to content

Commit

Permalink
🦸 Collections hero_image (#112)
Browse files Browse the repository at this point in the history
* Adds missing modules to production image

* Adds OV_DEBUG flag

* Adds more production env vars

* Adds manage.py to docker image

* Try deploy with pwd /app

* Binds prod server to 8000

* Adds s3 media access to production settings

* Fixes s3 custom domain

* Adds s3 url signatures

* Try with QUERYSTRING_AUTH

* Removes OV_ from AWS_ vars

* Actually removes OV_ from AWS_ vars

* Try without custom domain

* Adds frontend config to docker compose

* Adds ov_collection.hero_image

* Adds hero_thumb API rendition
  • Loading branch information
mrharpo authored Nov 16, 2023
1 parent ed5de47 commit 80e4e56
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
25 changes: 25 additions & 0 deletions ov_collections/migrations/0009_collection_hero_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 4.2.7 on 2023-11-14 23:39

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
dependencies = [
("wagtailimages", "0025_alter_image_file_alter_rendition_file"),
("ov_collections", "0008_alter_collection_content"),
]

operations = [
migrations.AddField(
model_name="collection",
name="hero_image",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="wagtailimages.image",
),
),
]
22 changes: 20 additions & 2 deletions ov_collections/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import ClassVar

from django.db import models
from wagtail.admin.panels import FieldPanel
from wagtail.admin.panels import FieldPanel, MultiFieldPanel
from wagtail.api import APIField
from wagtail.blocks import CharBlock, ListBlock, RichTextBlock, TextBlock
from wagtail.fields import RichTextField, StreamField
Expand Down Expand Up @@ -71,6 +71,14 @@ class Collection(Page):
related_name='+',
)

hero_image = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+',
)

search_fields: ClassVar[list[index.SearchField]] = [
*Page.search_fields,
index.SearchField('introduction'),
Expand All @@ -79,7 +87,9 @@ class Collection(Page):
content_panels: ClassVar[list[FieldPanel]] = [
*Page.content_panels,
FieldPanel('introduction'),
FieldPanel('cover_image'),
MultiFieldPanel(
[FieldPanel('cover_image'), FieldPanel('hero_image')], heading='Images'
),
FieldPanel('content'),
]

Expand All @@ -90,5 +100,13 @@ class Collection(Page):
'cover_image',
serializer=ImageRenditionField('fill-1600x500'),
),
APIField(
'hero_image',
serializer=ImageRenditionField('fill-1920x1080'),
),
APIField(
'hero_thumb',
serializer=ImageRenditionField('fill-480x270', source='hero_image'),
),
APIField('content'),
]

0 comments on commit 80e4e56

Please sign in to comment.