coalition.content.models

Content models package.

Submodules

Classes

ContentBlock

Flexible content blocks that can be added to any page.

HomePage

Model for managing homepage content.

Image

Model for storing images with metadata and attribution information.

Theme

Model for managing site themes and branding.

Video

Model for storing videos with metadata and attribution information.

Package Contents

class coalition.content.models.ContentBlock(*args, **kwargs)[source]

Bases: django.db.models.Model

Flexible content blocks that can be added to any page. Allows for dynamic content sections beyond the fixed structure.

BLOCK_TYPES = [('text', 'Text Block'), ('image', 'Image Block'), ('text_image', 'Text + Image Block'),...
PAGE_TYPES = [('homepage', 'Homepage'), ('about', 'About Page'), ('campaigns', 'Campaigns Page'), ('contact',...
LAYOUT_OPTIONS = [('default', 'Text Left, Image Right'), ('reversed', 'Image Left, Text Right'), ('stacked',...
VERTICAL_ALIGNMENT_OPTIONS = [('top', 'Top'), ('middle', 'Center'), ('bottom', 'Bottom')]
ANIMATION_OPTIONS = [('fade-in', 'Fade In'), ('slide-up', 'Slide Up'), ('slide-left', 'Slide from Left'),...
page_type
title
block_type
content
image
layout_option
vertical_alignment
css_classes
background_color
animation_type
animation_delay
order
is_visible
created_at
updated_at
class Meta
db_table = 'content_block'
ordering = ['order', 'created_at']
verbose_name = 'Content Block'
verbose_name_plural = 'Content Blocks'
__str__() str[source]
property image_url: str

Return the URL of the uploaded image, or empty string if no image.

property image_alt_text: str

Return the alt text of the image, or empty string if no image.

property image_title: str

Return the title of the image, or empty string if no image.

property image_author: str

Return the author of the image, or empty string if no image.

property image_license: str

Return the license of the image, or empty string if no image.

property image_source_url: str

Return the source URL of the image, or empty string if no image.

property image_caption: str

Return the caption of the image, or empty string if no image.

property image_caption_display: str

Return the caption display setting of the image, or ‘below’ if no image.

save(*args: Any, **kwargs: Any) None[source]

Sanitize content based on block type before saving.

class coalition.content.models.HomePage(*args, **kwargs)[source]

Bases: django.db.models.Model

Model for managing homepage content. Only one instance should exist - the active homepage configuration.

theme
organization_name
tagline
hero_title
hero_subtitle
hero_background_image
hero_background_video
hero_overlay_enabled
hero_overlay_color
hero_overlay_opacity
cta_title
cta_content
cta_button_text
cta_button_url
facebook_url
twitter_url
instagram_url
linkedin_url
campaigns_section_title
campaigns_section_subtitle
show_campaigns_section
is_active
created_at
updated_at
class Meta
db_table = 'homepage'
verbose_name = 'Homepage Configuration'
verbose_name_plural = 'Homepage Configurations'
__str__() str[source]
property hero_background_image_url: str

Return the URL of the hero background image, or empty string if no image.

property hero_background_video_url: str

Return the URL of the hero background video, or empty string if no video.

clean() None[source]

Validate homepage configuration

save(*args: Any, **kwargs: Any) None[source]

Sanitize HTML fields before saving.

classmethod get_active() HomePage | None[source]

Get the currently active homepage configuration

get_theme() Theme | None[source]

Get the effective theme for this homepage

class coalition.content.models.Image(*args, **kwargs)[source]

Bases: django.db.models.Model

Model for storing images with metadata and attribution information.

This model consolidates all image-related functionality across the application, providing proper attribution, licensing, and accessibility information.

image
title
alt_text
description
author
license
source_url
caption
CAPTION_DISPLAY_CHOICES = [('below', 'Below Image'), ('overlay', 'Overlay on Image'), ('tooltip', 'Tooltip on Hover'),...
caption_display
IMAGE_TYPES = [('general', 'General Image'), ('hero', 'Hero/Background Image'), ('content', 'Content Image'),...
image_type
created_at
updated_at
uploaded_by
class Meta
db_table = 'image'
verbose_name = 'Image'
verbose_name_plural = 'Images'
ordering = ['-created_at']
__str__() str[source]
property image_url: str

Return the URL of the uploaded image, or empty string if no image.

save(*args: Any, **kwargs: Any) None[source]

Sanitize text fields before saving.

class coalition.content.models.Theme(*args, **kwargs)[source]

Bases: django.db.models.Model

Model for managing site themes and branding. Allows organizations to customize colors, typography, and brand assets.

name
description
hex_color_validator
primary_color
secondary_color
accent_color
background_color
section_background_color
card_background_color
heading_color
body_text_color
muted_text_color
heading_font_family
body_font_family
google_fonts
font_size_base
font_size_small
font_size_large
logo_alt_text
favicon
custom_css
is_active
created_at
updated_at
class Meta
db_table = 'theme'
verbose_name = 'Theme'
verbose_name_plural = 'Themes'
ordering = ['-is_active', '-updated_at']
__str__() str[source]
property logo_url: str | None

Return the URL of the uploaded logo, or None if no logo.

property favicon_url: str | None

Return the URL of the uploaded favicon, or None if no favicon.

clean() None[source]

Ensure only one active theme exists

save(*args: Any, **kwargs: Any) None[source]

Sanitize custom CSS and validate before saving

classmethod get_active() Theme | None[source]

Get the currently active theme

generate_css_variables() str[source]

Generate CSS custom properties for this theme

class coalition.content.models.Video(*args, **kwargs)[source]

Bases: django.db.models.Model

Model for storing videos with metadata and attribution information.

This model handles video content across the application, providing proper attribution, licensing, and accessibility information.

video
title
alt_text
description
author
license
source_url
VIDEO_TYPES = [('general', 'General Video'), ('hero', 'Hero/Background Video'), ('content', 'Content Video'),...
video_type
autoplay
loop
muted
show_controls
created_at
updated_at
uploaded_by
class Meta
db_table = 'video'
verbose_name = 'Video'
verbose_name_plural = 'Videos'
ordering = ['-created_at']
__str__() str[source]
property video_url: str

Return the URL of the uploaded video, or empty string if no video.

clean() None[source]

Validate that autoplay videos are muted.

save(*args: Any, **kwargs: Any) None[source]

Sanitize text fields before saving.