coalition.content.models ======================== .. py:module:: coalition.content.models .. autoapi-nested-parse:: Content models package. Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/coalition/content/models/content_block/index /autoapi/coalition/content/models/homepage/index /autoapi/coalition/content/models/image/index /autoapi/coalition/content/models/theme/index /autoapi/coalition/content/models/video/index Classes ------- .. autoapisummary:: coalition.content.models.ContentBlock coalition.content.models.HomePage coalition.content.models.Image coalition.content.models.Theme coalition.content.models.Video Package Contents ---------------- .. py:class:: ContentBlock(*args, **kwargs) Bases: :py:obj:`django.db.models.Model` Flexible content blocks that can be added to any page. Allows for dynamic content sections beyond the fixed structure. .. py:attribute:: BLOCK_TYPES :value: [('text', 'Text Block'), ('image', 'Image Block'), ('text_image', 'Text + Image Block'),... .. py:attribute:: PAGE_TYPES :value: [('homepage', 'Homepage'), ('about', 'About Page'), ('campaigns', 'Campaigns Page'), ('contact',... .. py:attribute:: LAYOUT_OPTIONS :value: [('default', 'Text Left, Image Right'), ('reversed', 'Image Left, Text Right'), ('stacked',... .. py:attribute:: VERTICAL_ALIGNMENT_OPTIONS :value: [('top', 'Top'), ('middle', 'Center'), ('bottom', 'Bottom')] .. py:attribute:: ANIMATION_OPTIONS :value: [('fade-in', 'Fade In'), ('slide-up', 'Slide Up'), ('slide-left', 'Slide from Left'),... .. py:attribute:: page_type .. py:attribute:: title .. py:attribute:: block_type .. py:attribute:: content .. py:attribute:: image .. py:attribute:: layout_option .. py:attribute:: vertical_alignment .. py:attribute:: css_classes .. py:attribute:: background_color .. py:attribute:: animation_type .. py:attribute:: animation_delay .. py:attribute:: order .. py:attribute:: is_visible .. py:attribute:: created_at .. py:attribute:: updated_at .. py:class:: Meta .. py:attribute:: db_table :value: 'content_block' .. py:attribute:: ordering :value: ['order', 'created_at'] .. py:attribute:: verbose_name :value: 'Content Block' .. py:attribute:: verbose_name_plural :value: 'Content Blocks' .. py:method:: __str__() -> str .. py:property:: image_url :type: str Return the URL of the uploaded image, or empty string if no image. .. py:property:: image_alt_text :type: str Return the alt text of the image, or empty string if no image. .. py:property:: image_title :type: str Return the title of the image, or empty string if no image. .. py:property:: image_author :type: str Return the author of the image, or empty string if no image. .. py:property:: image_license :type: str Return the license of the image, or empty string if no image. .. py:property:: image_source_url :type: str Return the source URL of the image, or empty string if no image. .. py:property:: image_caption :type: str Return the caption of the image, or empty string if no image. .. py:property:: image_caption_display :type: str Return the caption display setting of the image, or 'below' if no image. .. py:method:: save(*args: Any, **kwargs: Any) -> None Sanitize content based on block type before saving. .. py:class:: HomePage(*args, **kwargs) Bases: :py:obj:`django.db.models.Model` Model for managing homepage content. Only one instance should exist - the active homepage configuration. .. py:attribute:: theme .. py:attribute:: organization_name .. py:attribute:: tagline .. py:attribute:: hero_title .. py:attribute:: hero_subtitle .. py:attribute:: hero_background_image .. py:attribute:: hero_background_video .. py:attribute:: hero_overlay_enabled .. py:attribute:: hero_overlay_color .. py:attribute:: hero_overlay_opacity .. py:attribute:: cta_title .. py:attribute:: cta_content .. py:attribute:: cta_button_text .. py:attribute:: cta_button_url .. py:attribute:: facebook_url .. py:attribute:: twitter_url .. py:attribute:: instagram_url .. py:attribute:: linkedin_url .. py:attribute:: campaigns_section_title .. py:attribute:: campaigns_section_subtitle .. py:attribute:: show_campaigns_section .. py:attribute:: is_active .. py:attribute:: created_at .. py:attribute:: updated_at .. py:class:: Meta .. py:attribute:: db_table :value: 'homepage' .. py:attribute:: verbose_name :value: 'Homepage Configuration' .. py:attribute:: verbose_name_plural :value: 'Homepage Configurations' .. py:method:: __str__() -> str .. py:property:: hero_background_image_url :type: str Return the URL of the hero background image, or empty string if no image. .. py:property:: hero_background_video_url :type: str Return the URL of the hero background video, or empty string if no video. .. py:method:: clean() -> None Validate homepage configuration .. py:method:: save(*args: Any, **kwargs: Any) -> None Sanitize HTML fields before saving. .. py:method:: get_active() -> HomePage | None :classmethod: Get the currently active homepage configuration .. py:method:: get_theme() -> Theme | None Get the effective theme for this homepage .. py:class:: Image(*args, **kwargs) Bases: :py:obj:`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. .. py:attribute:: image .. py:attribute:: title .. py:attribute:: alt_text .. py:attribute:: description .. py:attribute:: author .. py:attribute:: license .. py:attribute:: source_url .. py:attribute:: caption .. py:attribute:: CAPTION_DISPLAY_CHOICES :value: [('below', 'Below Image'), ('overlay', 'Overlay on Image'), ('tooltip', 'Tooltip on Hover'),... .. py:attribute:: caption_display .. py:attribute:: IMAGE_TYPES :value: [('general', 'General Image'), ('hero', 'Hero/Background Image'), ('content', 'Content Image'),... .. py:attribute:: image_type .. py:attribute:: created_at .. py:attribute:: updated_at .. py:attribute:: uploaded_by .. py:class:: Meta .. py:attribute:: db_table :value: 'image' .. py:attribute:: verbose_name :value: 'Image' .. py:attribute:: verbose_name_plural :value: 'Images' .. py:attribute:: ordering :value: ['-created_at'] .. py:method:: __str__() -> str .. py:property:: image_url :type: str Return the URL of the uploaded image, or empty string if no image. .. py:method:: save(*args: Any, **kwargs: Any) -> None Sanitize text fields before saving. .. py:class:: Theme(*args, **kwargs) Bases: :py:obj:`django.db.models.Model` Model for managing site themes and branding. Allows organizations to customize colors, typography, and brand assets. .. py:attribute:: name .. py:attribute:: description .. py:attribute:: hex_color_validator .. py:attribute:: primary_color .. py:attribute:: secondary_color .. py:attribute:: accent_color .. py:attribute:: background_color .. py:attribute:: section_background_color .. py:attribute:: card_background_color .. py:attribute:: heading_color .. py:attribute:: body_text_color .. py:attribute:: muted_text_color .. py:attribute:: link_color .. py:attribute:: link_hover_color .. py:attribute:: heading_font_family .. py:attribute:: body_font_family .. py:attribute:: google_fonts .. py:attribute:: font_size_base .. py:attribute:: font_size_small .. py:attribute:: font_size_large .. py:attribute:: logo .. py:attribute:: logo_alt_text .. py:attribute:: favicon .. py:attribute:: custom_css .. py:attribute:: is_active .. py:attribute:: created_at .. py:attribute:: updated_at .. py:class:: Meta .. py:attribute:: db_table :value: 'theme' .. py:attribute:: verbose_name :value: 'Theme' .. py:attribute:: verbose_name_plural :value: 'Themes' .. py:attribute:: ordering :value: ['-is_active', '-updated_at'] .. py:method:: __str__() -> str .. py:property:: logo_url :type: str | None Return the URL of the uploaded logo, or None if no logo. .. py:property:: favicon_url :type: str | None Return the URL of the uploaded favicon, or None if no favicon. .. py:method:: clean() -> None Ensure only one active theme exists .. py:method:: save(*args: Any, **kwargs: Any) -> None Sanitize custom CSS and validate before saving .. py:method:: get_active() -> Theme | None :classmethod: Get the currently active theme .. py:method:: generate_css_variables() -> str Generate CSS custom properties for this theme .. py:class:: Video(*args, **kwargs) Bases: :py:obj:`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. .. py:attribute:: video .. py:attribute:: title .. py:attribute:: alt_text .. py:attribute:: description .. py:attribute:: author .. py:attribute:: license .. py:attribute:: source_url .. py:attribute:: VIDEO_TYPES :value: [('general', 'General Video'), ('hero', 'Hero/Background Video'), ('content', 'Content Video'),... .. py:attribute:: video_type .. py:attribute:: autoplay .. py:attribute:: loop .. py:attribute:: muted .. py:attribute:: show_controls .. py:attribute:: created_at .. py:attribute:: updated_at .. py:attribute:: uploaded_by .. py:class:: Meta .. py:attribute:: db_table :value: 'video' .. py:attribute:: verbose_name :value: 'Video' .. py:attribute:: verbose_name_plural :value: 'Videos' .. py:attribute:: ordering :value: ['-created_at'] .. py:method:: __str__() -> str .. py:property:: video_url :type: str Return the URL of the uploaded video, or empty string if no video. .. py:method:: clean() -> None Validate that autoplay videos are muted. .. py:method:: save(*args: Any, **kwargs: Any) -> None Sanitize text fields before saving.